<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>ConvertUtil xref</title>
<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />
</head>
<body>
<div id="overview"><a href="../../../../../../../../../feilong-core/target/site/apidocs/com/feilong/core/bean/ConvertUtil.html">View Javadoc</a></div><pre>
<a class="jxr_linenumber" name="L1" href="#L1">1</a>   <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="L2" href="#L2">2</a>   <em class="jxr_comment"> * Copyright (C) 2008 feilong</em>
<a class="jxr_linenumber" name="L3" href="#L3">3</a>   <em class="jxr_comment"> *</em>
<a class="jxr_linenumber" name="L4" href="#L4">4</a>   <em class="jxr_comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
<a class="jxr_linenumber" name="L5" href="#L5">5</a>   <em class="jxr_comment"> * you may not use this file except in compliance with the License.</em>
<a class="jxr_linenumber" name="L6" href="#L6">6</a>   <em class="jxr_comment"> * You may obtain a copy of the License at</em>
<a class="jxr_linenumber" name="L7" href="#L7">7</a>   <em class="jxr_comment"> *</em>
<a class="jxr_linenumber" name="L8" href="#L8">8</a>   <em class="jxr_comment"> *         <a href="http://www.apache.org/licenses/LICENSE-2." target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.</a>0</em>
<a class="jxr_linenumber" name="L9" href="#L9">9</a>   <em class="jxr_comment"> *</em>
<a class="jxr_linenumber" name="L10" href="#L10">10</a>  <em class="jxr_comment"> * Unless required by applicable law or agreed to in writing, software</em>
<a class="jxr_linenumber" name="L11" href="#L11">11</a>  <em class="jxr_comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
<a class="jxr_linenumber" name="L12" href="#L12">12</a>  <em class="jxr_comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
<a class="jxr_linenumber" name="L13" href="#L13">13</a>  <em class="jxr_comment"> * See the License for the specific language governing permissions and</em>
<a class="jxr_linenumber" name="L14" href="#L14">14</a>  <em class="jxr_comment"> * limitations under the License.</em>
<a class="jxr_linenumber" name="L15" href="#L15">15</a>  <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="L16" href="#L16">16</a>  <strong class="jxr_keyword">package</strong> com.feilong.core.bean;
<a class="jxr_linenumber" name="L17" href="#L17">17</a>  
<a class="jxr_linenumber" name="L18" href="#L18">18</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> java.util.Collections.emptyMap;
<a class="jxr_linenumber" name="L19" href="#L19">19</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.apache.commons.lang3.ObjectUtils.defaultIfNull;
<a class="jxr_linenumber" name="L20" href="#L20">20</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.apache.commons.lang3.StringUtils.EMPTY;
<a class="jxr_linenumber" name="L21" href="#L21">21</a>  
<a class="jxr_linenumber" name="L22" href="#L22">22</a>  <strong class="jxr_keyword">import</strong> java.math.BigDecimal;
<a class="jxr_linenumber" name="L23" href="#L23">23</a>  <strong class="jxr_keyword">import</strong> java.util.ArrayList;
<a class="jxr_linenumber" name="L24" href="#L24">24</a>  <strong class="jxr_keyword">import</strong> java.util.Arrays;
<a class="jxr_linenumber" name="L25" href="#L25">25</a>  <strong class="jxr_keyword">import</strong> java.util.Collection;
<a class="jxr_linenumber" name="L26" href="#L26">26</a>  <strong class="jxr_keyword">import</strong> java.util.Collections;
<a class="jxr_linenumber" name="L27" href="#L27">27</a>  <strong class="jxr_keyword">import</strong> java.util.Enumeration;
<a class="jxr_linenumber" name="L28" href="#L28">28</a>  <strong class="jxr_keyword">import</strong> java.util.Iterator;
<a class="jxr_linenumber" name="L29" href="#L29">29</a>  <strong class="jxr_keyword">import</strong> java.util.LinkedHashMap;
<a class="jxr_linenumber" name="L30" href="#L30">30</a>  <strong class="jxr_keyword">import</strong> java.util.LinkedHashSet;
<a class="jxr_linenumber" name="L31" href="#L31">31</a>  <strong class="jxr_keyword">import</strong> java.util.List;
<a class="jxr_linenumber" name="L32" href="#L32">32</a>  <strong class="jxr_keyword">import</strong> java.util.Locale;
<a class="jxr_linenumber" name="L33" href="#L33">33</a>  <strong class="jxr_keyword">import</strong> java.util.Map;
<a class="jxr_linenumber" name="L34" href="#L34">34</a>  <strong class="jxr_keyword">import</strong> java.util.Properties;
<a class="jxr_linenumber" name="L35" href="#L35">35</a>  <strong class="jxr_keyword">import</strong> java.util.Set;
<a class="jxr_linenumber" name="L36" href="#L36">36</a>  
<a class="jxr_linenumber" name="L37" href="#L37">37</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.ConvertUtils;
<a class="jxr_linenumber" name="L38" href="#L38">38</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.ConvertUtilsBean;
<a class="jxr_linenumber" name="L39" href="#L39">39</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.Converter;
<a class="jxr_linenumber" name="L40" href="#L40">40</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.AbstractConverter;
<a class="jxr_linenumber" name="L41" href="#L41">41</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.ArrayConverter;
<a class="jxr_linenumber" name="L42" href="#L42">42</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.BigDecimalConverter;
<a class="jxr_linenumber" name="L43" href="#L43">43</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.BooleanConverter;
<a class="jxr_linenumber" name="L44" href="#L44">44</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.IntegerConverter;
<a class="jxr_linenumber" name="L45" href="#L45">45</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.LongConverter;
<a class="jxr_linenumber" name="L46" href="#L46">46</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.beanutils.converters.NumberConverter;
<a class="jxr_linenumber" name="L47" href="#L47">47</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.collections4.EnumerationUtils;
<a class="jxr_linenumber" name="L48" href="#L48">48</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.collections4.IteratorUtils;
<a class="jxr_linenumber" name="L49" href="#L49">49</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.collections4.MapUtils;
<a class="jxr_linenumber" name="L50" href="#L50">50</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.collections4.Transformer;
<a class="jxr_linenumber" name="L51" href="#L51">51</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.collections4.iterators.EnumerationIterator;
<a class="jxr_linenumber" name="L52" href="#L52">52</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.lang3.ArrayUtils;
<a class="jxr_linenumber" name="L53" href="#L53">53</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.lang3.LocaleUtils;
<a class="jxr_linenumber" name="L54" href="#L54">54</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.lang3.StringUtils;
<a class="jxr_linenumber" name="L55" href="#L55">55</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.lang3.Validate;
<a class="jxr_linenumber" name="L56" href="#L56">56</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.lang3.tuple.Pair;
<a class="jxr_linenumber" name="L57" href="#L57">57</a>  
<a class="jxr_linenumber" name="L58" href="#L58">58</a>  <strong class="jxr_keyword">import</strong> com.feilong.core.lang.ArrayUtil;
<a class="jxr_linenumber" name="L59" href="#L59">59</a>  <strong class="jxr_keyword">import</strong> com.feilong.core.lang.StringUtil;
<a class="jxr_linenumber" name="L60" href="#L60">60</a>  <strong class="jxr_keyword">import</strong> com.feilong.core.util.SortUtil;
<a class="jxr_linenumber" name="L61" href="#L61">61</a>  <strong class="jxr_keyword">import</strong> com.feilong.core.util.transformer.SimpleClassTransformer;
<a class="jxr_linenumber" name="L62" href="#L62">62</a>  
<a class="jxr_linenumber" name="L63" href="#L63">63</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> com.feilong.core.Validator.isNullOrEmpty;
<a class="jxr_linenumber" name="L64" href="#L64">64</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> com.feilong.core.util.MapUtil.newLinkedHashMap;
<a class="jxr_linenumber" name="L65" href="#L65">65</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> com.feilong.core.util.SortUtil.sortMapByKeyAsc;
<a class="jxr_linenumber" name="L66" href="#L66">66</a>  
<a class="jxr_linenumber" name="L67" href="#L67">67</a>  <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L68" href="#L68">68</a>  <em class="jxr_javadoccomment"> * 常用类型转换处理.</em>
<a class="jxr_linenumber" name="L69" href="#L69">69</a>  <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L70" href="#L70">70</a>  <em class="jxr_javadoccomment"> * &lt;h3&gt;关于类型转换:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L71" href="#L71">71</a>  <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L72" href="#L72">72</a>  <em class="jxr_javadoccomment"> * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L73" href="#L73">73</a>  <em class="jxr_javadoccomment"> * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L74" href="#L74">74</a>  <em class="jxr_javadoccomment"> * &lt;li&gt;{@link ConvertUtilsBean#registerPrimitives(boolean) registerPrimitives(boolean throwException)}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L75" href="#L75">75</a>  <em class="jxr_javadoccomment"> * &lt;li&gt;{@link ConvertUtilsBean#registerStandard(boolean,boolean) registerStandard(boolean throwException, boolean defaultNull);}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L76" href="#L76">76</a>  <em class="jxr_javadoccomment"> * &lt;li&gt;{@link ConvertUtilsBean#registerOther(boolean) registerOther(boolean throwException);}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L77" href="#L77">77</a>  <em class="jxr_javadoccomment"> * &lt;li&gt;{@link ConvertUtilsBean#registerArrays(boolean,int) registerArrays(boolean throwException, int defaultArraySize);}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L78" href="#L78">78</a>  <em class="jxr_javadoccomment"> * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L79" href="#L79">79</a>  <em class="jxr_javadoccomment"> * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L80" href="#L80">80</a>  <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L81" href="#L81">81</a>  <em class="jxr_javadoccomment"> * &lt;h3&gt;{@link ConvertUtils} 几个方法的区别:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L82" href="#L82">82</a>  <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L83" href="#L83">83</a>  <em class="jxr_javadoccomment"> * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L84" href="#L84">84</a>  <em class="jxr_javadoccomment"> * &lt;table border="1" cellspacing="0" cellpadding="4" summary=""&gt;</em>
<a class="jxr_linenumber" name="L85" href="#L85">85</a>  <em class="jxr_javadoccomment"> * &lt;tr style="background-color:#ccccff"&gt;</em>
<a class="jxr_linenumber" name="L86" href="#L86">86</a>  <em class="jxr_javadoccomment"> * &lt;th align="left"&gt;方法&lt;/th&gt;</em>
<a class="jxr_linenumber" name="L87" href="#L87">87</a>  <em class="jxr_javadoccomment"> * &lt;th align="left"&gt;说明&lt;/th&gt;</em>
<a class="jxr_linenumber" name="L88" href="#L88">88</a>  <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L89" href="#L89">89</a>  <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L90" href="#L90">90</a>  <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L91" href="#L91">91</a>  <em class="jxr_javadoccomment"> * &lt;td&gt;{@link ConvertUtils#convert(Object)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L92" href="#L92">92</a>  <em class="jxr_javadoccomment"> * &lt;td&gt;将指定的value转成string.&lt;br&gt;</em>
<a class="jxr_linenumber" name="L93" href="#L93">93</a>  <em class="jxr_javadoccomment"> * 如果value是array,将会返回数组第一个元素转成string.&lt;br&gt;</em>
<a class="jxr_linenumber" name="L94" href="#L94">94</a>  <em class="jxr_javadoccomment"> * 将会使用注册的 &lt;code&gt;java.lang.String&lt;/code&gt;{@link Converter},&lt;br&gt;</em>
<a class="jxr_linenumber" name="L95" href="#L95">95</a>  <em class="jxr_javadoccomment"> * 允许应用定制 Object{@code -&gt;}String conversions(默认使用简单的使用 toString())&lt;br&gt;</em>
<a class="jxr_linenumber" name="L96" href="#L96">96</a>  <em class="jxr_javadoccomment"> * see {@link ConvertUtilsBean#convert(Object)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L97" href="#L97">97</a>  <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L98" href="#L98">98</a>  <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L99" href="#L99">99</a>  <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L100" href="#L100">100</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link ConvertUtils#convert(String, Class)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L101" href="#L101">101</a> <em class="jxr_javadoccomment"> * &lt;td&gt;将String value转成 指定Class 类型的对象 (如果可能),否则返回string.&lt;br&gt;</em>
<a class="jxr_linenumber" name="L102" href="#L102">102</a> <em class="jxr_javadoccomment"> * see {@link ConvertUtilsBean#convert(String, Class)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L103" href="#L103">103</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L104" href="#L104">104</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L105" href="#L105">105</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L106" href="#L106">106</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link ConvertUtils#convert(String[], Class)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L107" href="#L107">107</a> <em class="jxr_javadoccomment"> * &lt;td&gt;将数组转成指定class类型的对象. &lt;br&gt;</em>
<a class="jxr_linenumber" name="L108" href="#L108">108</a> <em class="jxr_javadoccomment"> * 如果指定的Class类型是数组类型,那么返回值的类型将是数组的类型.否则将会构造一个指定类型的数组返回.&lt;br&gt;</em>
<a class="jxr_linenumber" name="L109" href="#L109">109</a> <em class="jxr_javadoccomment"> * see {@link ConvertUtilsBean#convert(String[], Class)} &lt;br&gt;</em>
<a class="jxr_linenumber" name="L110" href="#L110">110</a> <em class="jxr_javadoccomment"> * see {@link #toArray(String[], Class)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L111" href="#L111">111</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L112" href="#L112">112</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L113" href="#L113">113</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L114" href="#L114">114</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link ConvertUtils#convert(Object, Class)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L115" href="#L115">115</a> <em class="jxr_javadoccomment"> * &lt;td&gt;将value转成指定Class类型的对象,如果Class的转换器没有注册,那么传入的value原样返回.&lt;br&gt;</em>
<a class="jxr_linenumber" name="L116" href="#L116">116</a> <em class="jxr_javadoccomment"> * see {@link ConvertUtilsBean#convert(Object, Class)}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L117" href="#L117">117</a> <em class="jxr_javadoccomment"> * see {@link #convert(Object, Class)}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L118" href="#L118">118</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L119" href="#L119">119</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L120" href="#L120">120</a> <em class="jxr_javadoccomment"> * &lt;/table&gt;</em>
<a class="jxr_linenumber" name="L121" href="#L121">121</a> <em class="jxr_javadoccomment"> * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L122" href="#L122">122</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L123" href="#L123">123</a> <em class="jxr_javadoccomment"> * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L124" href="#L124">124</a> <em class="jxr_javadoccomment"> * standard {@link Converter} instances are provided for all of the following destination Classes:</em>
<a class="jxr_linenumber" name="L125" href="#L125">125</a> <em class="jxr_javadoccomment"> * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L126" href="#L126">126</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L127" href="#L127">127</a> <em class="jxr_javadoccomment"> * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L128" href="#L128">128</a> <em class="jxr_javadoccomment"> * &lt;table border="1" cellspacing="0" cellpadding="4" summary=""&gt;</em>
<a class="jxr_linenumber" name="L129" href="#L129">129</a> <em class="jxr_javadoccomment"> * &lt;tr style="background-color:#ccccff"&gt;</em>
<a class="jxr_linenumber" name="L130" href="#L130">130</a> <em class="jxr_javadoccomment"> * &lt;th align="left"&gt;字段&lt;/th&gt;</em>
<a class="jxr_linenumber" name="L131" href="#L131">131</a> <em class="jxr_javadoccomment"> * &lt;th align="left"&gt;说明&lt;/th&gt;</em>
<a class="jxr_linenumber" name="L132" href="#L132">132</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L133" href="#L133">133</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L134" href="#L134">134</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L135" href="#L135">135</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.math.BigDecimal}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L136" href="#L136">136</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L137" href="#L137">137</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L138" href="#L138">138</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L139" href="#L139">139</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L140" href="#L140">140</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.math.BigInteger}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L141" href="#L141">141</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L142" href="#L142">142</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L143" href="#L143">143</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L144" href="#L144">144</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L145" href="#L145">145</a> <em class="jxr_javadoccomment"> * &lt;td&gt;boolean and {@link java.lang.Boolean}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L146" href="#L146">146</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to false&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L147" href="#L147">147</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L148" href="#L148">148</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L149" href="#L149">149</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L150" href="#L150">150</a> <em class="jxr_javadoccomment"> * &lt;td&gt;byte and {@link java.lang.Byte}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L151" href="#L151">151</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to zero&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L152" href="#L152">152</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L153" href="#L153">153</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L154" href="#L154">154</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L155" href="#L155">155</a> <em class="jxr_javadoccomment"> * &lt;td&gt;char and {@link java.lang.Character}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L156" href="#L156">156</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to a space&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L157" href="#L157">157</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L158" href="#L158">158</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L159" href="#L159">159</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L160" href="#L160">160</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.lang.Class}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L161" href="#L161">161</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L162" href="#L162">162</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L163" href="#L163">163</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L164" href="#L164">164</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L165" href="#L165">165</a> <em class="jxr_javadoccomment"> * &lt;td&gt;double and {@link java.lang.Double}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L166" href="#L166">166</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to zero&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L167" href="#L167">167</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L168" href="#L168">168</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L169" href="#L169">169</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L170" href="#L170">170</a> <em class="jxr_javadoccomment"> * &lt;td&gt;float and {@link java.lang.Float}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L171" href="#L171">171</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to zero&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L172" href="#L172">172</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L173" href="#L173">173</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L174" href="#L174">174</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L175" href="#L175">175</a> <em class="jxr_javadoccomment"> * &lt;td&gt;int and {@link java.lang.Integer}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L176" href="#L176">176</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to zero&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L177" href="#L177">177</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L178" href="#L178">178</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L179" href="#L179">179</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L180" href="#L180">180</a> <em class="jxr_javadoccomment"> * &lt;td&gt;long and {@link java.lang.Long}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L181" href="#L181">181</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to zero&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L182" href="#L182">182</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L183" href="#L183">183</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L184" href="#L184">184</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L185" href="#L185">185</a> <em class="jxr_javadoccomment"> * &lt;td&gt;short and {@link java.lang.Short}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L186" href="#L186">186</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to zero&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L187" href="#L187">187</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L188" href="#L188">188</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L189" href="#L189">189</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L190" href="#L190">190</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.lang.String}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L191" href="#L191">191</a> <em class="jxr_javadoccomment"> * &lt;td&gt;default to null&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L192" href="#L192">192</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L193" href="#L193">193</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L194" href="#L194">194</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L195" href="#L195">195</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.io.File}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L196" href="#L196">196</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L197" href="#L197">197</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L198" href="#L198">198</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L199" href="#L199">199</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L200" href="#L200">200</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.net.URL}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L201" href="#L201">201</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L202" href="#L202">202</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L203" href="#L203">203</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L204" href="#L204">204</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L205" href="#L205">205</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.sql.Date}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L206" href="#L206">206</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L207" href="#L207">207</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L208" href="#L208">208</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L209" href="#L209">209</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L210" href="#L210">210</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.sql.Time}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L211" href="#L211">211</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L212" href="#L212">212</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L213" href="#L213">213</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L214" href="#L214">214</a> <em class="jxr_javadoccomment"> * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L215" href="#L215">215</a> <em class="jxr_javadoccomment"> * &lt;td&gt;{@link java.sql.Timestamp}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L216" href="#L216">216</a> <em class="jxr_javadoccomment"> * &lt;td&gt;&lt;span style="color:red"&gt;no default value&lt;/span&gt;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L217" href="#L217">217</a> <em class="jxr_javadoccomment"> * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L218" href="#L218">218</a> <em class="jxr_javadoccomment"> * &lt;/table&gt;</em>
<a class="jxr_linenumber" name="L219" href="#L219">219</a> <em class="jxr_javadoccomment"> * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L220" href="#L220">220</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L221" href="#L221">221</a> <em class="jxr_javadoccomment"> * @author &lt;a href="<a href="http://feitianbenyue.iteye.com/" target="alexandria_uri">http://feitianbenyue.iteye.com/</a>"&gt;feilong&lt;/a&gt;</em>
<a class="jxr_linenumber" name="L222" href="#L222">222</a> <em class="jxr_javadoccomment"> * @see org.apache.commons.beanutils.ConvertUtils</em>
<a class="jxr_linenumber" name="L223" href="#L223">223</a> <em class="jxr_javadoccomment"> * @see org.apache.commons.beanutils.converters.AbstractConverter#handleMissing(Class)</em>
<a class="jxr_linenumber" name="L224" href="#L224">224</a> <em class="jxr_javadoccomment"> * @see org.apache.commons.beanutils.locale.LocaleConvertUtils</em>
<a class="jxr_linenumber" name="L225" href="#L225">225</a> <em class="jxr_javadoccomment"> * @since 1.3.0</em>
<a class="jxr_linenumber" name="L226" href="#L226">226</a> <em class="jxr_javadoccomment"> */</em>
<a class="jxr_linenumber" name="L227" href="#L227">227</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../com/feilong/core/bean/ConvertUtil.html">ConvertUtil</a>{
<a class="jxr_linenumber" name="L228" href="#L228">228</a> 
<a class="jxr_linenumber" name="L229" href="#L229">229</a>     <em class="jxr_javadoccomment">/** Don't let anyone instantiate this class. */</em>
<a class="jxr_linenumber" name="L230" href="#L230">230</a>     <strong class="jxr_keyword">private</strong> <a href="../../../../com/feilong/core/bean/ConvertUtil.html">ConvertUtil</a>(){
<a class="jxr_linenumber" name="L231" href="#L231">231</a>         <em class="jxr_comment">//AssertionError不是必须的. 但它可以避免不小心在类的内部调用构造器. 保证该类在任何情况下都不会被实例化.</em>
<a class="jxr_linenumber" name="L232" href="#L232">232</a>         <em class="jxr_comment">//see 《Effective Java》 2nd</em>
<a class="jxr_linenumber" name="L233" href="#L233">233</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> AssertionError(<span class="jxr_string">"No "</span> + getClass().getName() + <span class="jxr_string">" instances for you!"</span>);
<a class="jxr_linenumber" name="L234" href="#L234">234</a>     }
<a class="jxr_linenumber" name="L235" href="#L235">235</a> 
<a class="jxr_linenumber" name="L236" href="#L236">236</a>     <em class="jxr_comment">//*****************************************************************************************************</em>
<a class="jxr_linenumber" name="L237" href="#L237">237</a> 
<a class="jxr_linenumber" name="L238" href="#L238">238</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L239" href="#L239">239</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转换成 {@link Boolean}类型.</em>
<a class="jxr_linenumber" name="L240" href="#L240">240</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L241" href="#L241">241</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L242" href="#L242">242</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L243" href="#L243">243</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L244" href="#L244">244</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L245" href="#L245">245</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L246" href="#L246">246</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L247" href="#L247">247</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBoolean(null)      =   null</em>
<a class="jxr_linenumber" name="L248" href="#L248">248</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L249" href="#L249">249</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBoolean(1L)        =   true</em>
<a class="jxr_linenumber" name="L250" href="#L250">250</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBoolean("1")       =   true</em>
<a class="jxr_linenumber" name="L251" href="#L251">251</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBoolean("9")       =   false</em>
<a class="jxr_linenumber" name="L252" href="#L252">252</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBoolean("1,2,3")   =   false</em>
<a class="jxr_linenumber" name="L253" href="#L253">253</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L254" href="#L254">254</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L255" href="#L255">255</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L256" href="#L256">256</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L257" href="#L257">257</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;逻辑及规则:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L258" href="#L258">258</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L259" href="#L259">259</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L260" href="#L260">260</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L261" href="#L261">261</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L262" href="#L262">262</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果 "true", "yes", "y", "on", "1", 返回 true&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L263" href="#L263">263</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果 "false", "no", "n", "off", "0", 返回 false&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L264" href="#L264">264</a> <em class="jxr_javadoccomment">     * &lt;li&gt;其他抛出 conversionException, 但是在</em>
<a class="jxr_linenumber" name="L265" href="#L265">265</a> <em class="jxr_javadoccomment">     * {@link org.apache.commons.beanutils.converters.AbstractConverter#handleError(Class, Object, Throwable) handleError(Class, Object,</em>
<a class="jxr_linenumber" name="L266" href="#L266">266</a> <em class="jxr_javadoccomment">     * Throwable)} 方法里面返回默认值, {@link BooleanConverter} 的默认值,参见</em>
<a class="jxr_linenumber" name="L267" href="#L267">267</a> <em class="jxr_javadoccomment">     * {@link org.apache.commons.beanutils.ConvertUtilsBean#registerStandard(boolean, boolean) registerStandard(boolean, boolean)}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L268" href="#L268">268</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L269" href="#L269">269</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L270" href="#L270">270</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L271" href="#L271">271</a> <em class="jxr_javadoccomment">     * 你也可以调用 {@link org.apache.commons.beanutils.converters.BooleanConverter#BooleanConverter(String[], String[], Object)</em>
<a class="jxr_linenumber" name="L272" href="#L272">272</a> <em class="jxr_javadoccomment">     * BooleanConverter(String[], String[], Object)} 设置 trueStrings 和 falseStrings</em>
<a class="jxr_linenumber" name="L273" href="#L273">273</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L274" href="#L274">274</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L275" href="#L275">275</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L276" href="#L276">276</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;和 {@link Boolean#parseBoolean(String)}的区别:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L277" href="#L277">277</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L278" href="#L278">278</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L279" href="#L279">279</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L280" href="#L280">280</a> <em class="jxr_javadoccomment">     * {@link Boolean#parseBoolean(String)},仅当 &lt;code&gt;(String != null) 并且 String.equalsIgnoreCase("true")&lt;/code&gt; 返回 true</em>
<a class="jxr_linenumber" name="L281" href="#L281">281</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L282" href="#L282">282</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L283" href="#L283">283</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L284" href="#L284">284</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L285" href="#L285">285</a> <em class="jxr_javadoccomment">     *            object</em>
<a class="jxr_linenumber" name="L286" href="#L286">286</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L287" href="#L287">287</a> <em class="jxr_javadoccomment">     * @see #convert(Object, Class)</em>
<a class="jxr_linenumber" name="L288" href="#L288">288</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.BooleanConverter</em>
<a class="jxr_linenumber" name="L289" href="#L289">289</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.BooleanUtils</em>
<a class="jxr_linenumber" name="L290" href="#L290">290</a> <em class="jxr_javadoccomment">     * @see java.lang.Boolean#parseBoolean(String)</em>
<a class="jxr_linenumber" name="L291" href="#L291">291</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L292" href="#L292">292</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Boolean toBoolean(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L293" href="#L293">293</a>         <strong class="jxr_keyword">return</strong> convert(toBeConvertedValue, Boolean.<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="L294" href="#L294">294</a>     }
<a class="jxr_linenumber" name="L295" href="#L295">295</a> 
<a class="jxr_linenumber" name="L296" href="#L296">296</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L297" href="#L297">297</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转换成 {@link Integer}类型.</em>
<a class="jxr_linenumber" name="L298" href="#L298">298</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L299" href="#L299">299</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L300" href="#L300">300</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L301" href="#L301">301</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L302" href="#L302">302</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L303" href="#L303">303</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L304" href="#L304">304</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L305" href="#L305">305</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(null)                  = null</em>
<a class="jxr_linenumber" name="L306" href="#L306">306</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger("aaaa")                = null</em>
<a class="jxr_linenumber" name="L307" href="#L307">307</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(8L)                    = 8</em>
<a class="jxr_linenumber" name="L308" href="#L308">308</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger("8")                   = 8</em>
<a class="jxr_linenumber" name="L309" href="#L309">309</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(new BigDecimal("8"))   = 8</em>
<a class="jxr_linenumber" name="L310" href="#L310">310</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L311" href="#L311">311</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L312" href="#L312">312</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L313" href="#L313">313</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} L227:</em>
<a class="jxr_linenumber" name="L314" href="#L314">314</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L315" href="#L315">315</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L316" href="#L316">316</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L317" href="#L317">317</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(new String[] { "1", "2", "3" }) = 1</em>
<a class="jxr_linenumber" name="L318" href="#L318">318</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L319" href="#L319">319</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L320" href="#L320">320</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L321" href="#L321">321</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} Line234:</em>
<a class="jxr_linenumber" name="L322" href="#L322">322</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L323" href="#L323">323</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L324" href="#L324">324</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L325" href="#L325">325</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(toList("1", "2")) = 1</em>
<a class="jxr_linenumber" name="L326" href="#L326">326</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L327" href="#L327">327</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L328" href="#L328">328</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L329" href="#L329">329</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L330" href="#L330">330</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L331" href="#L331">331</a> <em class="jxr_javadoccomment">     * 该方法非常适用 获取request请求的分页参数</em>
<a class="jxr_linenumber" name="L332" href="#L332">332</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L333" href="#L333">333</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L334" href="#L334">334</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L335" href="#L335">335</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L336" href="#L336">336</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L337" href="#L337">337</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L338" href="#L338">338</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L339" href="#L339">339</a> <em class="jxr_javadoccomment">     * 原来的写法:</em>
<a class="jxr_linenumber" name="L340" href="#L340">340</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L341" href="#L341">341</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L342" href="#L342">342</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L343" href="#L343">343</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L344" href="#L344">344</a> <em class="jxr_javadoccomment">     * public static Integer getCurrentPageNo(HttpServletRequest request,String pageParamName){</em>
<a class="jxr_linenumber" name="L345" href="#L345">345</a> <em class="jxr_javadoccomment">     *     String pageNoString = RequestUtil.getParameter(request, pageParamName);</em>
<a class="jxr_linenumber" name="L346" href="#L346">346</a> <em class="jxr_javadoccomment">     *     try{</em>
<a class="jxr_linenumber" name="L347" href="#L347">347</a> <em class="jxr_javadoccomment">     *         int pageNo = Integer.parseInt(pageNoString);</em>
<a class="jxr_linenumber" name="L348" href="#L348">348</a> <em class="jxr_javadoccomment">     *         return pageNo;</em>
<a class="jxr_linenumber" name="L349" href="#L349">349</a> <em class="jxr_javadoccomment">     *     }catch (Exception e){</em>
<a class="jxr_linenumber" name="L350" href="#L350">350</a> <em class="jxr_javadoccomment">     *         LOGGER.error(e.getClass().getName(), e);</em>
<a class="jxr_linenumber" name="L351" href="#L351">351</a> <em class="jxr_javadoccomment">     *     }</em>
<a class="jxr_linenumber" name="L352" href="#L352">352</a> <em class="jxr_javadoccomment">     *     return 1; &lt;span style="color:green"&gt;// 不带这个参数或者转换异常返回1&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L353" href="#L353">353</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L354" href="#L354">354</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L355" href="#L355">355</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L356" href="#L356">356</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L357" href="#L357">357</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L358" href="#L358">358</a> <em class="jxr_javadoccomment">     * 现在可以更改成:</em>
<a class="jxr_linenumber" name="L359" href="#L359">359</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L360" href="#L360">360</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L361" href="#L361">361</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L362" href="#L362">362</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L363" href="#L363">363</a> <em class="jxr_javadoccomment">     * public static Integer getCurrentPageNo(HttpServletRequest request,String pageParamName){</em>
<a class="jxr_linenumber" name="L364" href="#L364">364</a> <em class="jxr_javadoccomment">     *     String pageNoString = RequestUtil.getParameter(request, pageParamName);</em>
<a class="jxr_linenumber" name="L365" href="#L365">365</a> <em class="jxr_javadoccomment">     *     Integer pageNo = ConvertUtil.toInteger(pageNoString);</em>
<a class="jxr_linenumber" name="L366" href="#L366">366</a> <em class="jxr_javadoccomment">     *     return null == pageNo ? 1 : pageNo;</em>
<a class="jxr_linenumber" name="L367" href="#L367">367</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L368" href="#L368">368</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L369" href="#L369">369</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L370" href="#L370">370</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L371" href="#L371">371</a> <em class="jxr_javadoccomment">     * 当然对于这种场景,最快捷的:调用支持默认值的 {@link #toInteger(Object, Integer)} 方法</em>
<a class="jxr_linenumber" name="L372" href="#L372">372</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L373" href="#L373">373</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L374" href="#L374">374</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L375" href="#L375">375</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L376" href="#L376">376</a> <em class="jxr_javadoccomment">     * public static Integer getCurrentPageNo(HttpServletRequest request,String pageParamName){</em>
<a class="jxr_linenumber" name="L377" href="#L377">377</a> <em class="jxr_javadoccomment">     *     String pageNoString = RequestUtil.getParameter(request, pageParamName);</em>
<a class="jxr_linenumber" name="L378" href="#L378">378</a> <em class="jxr_javadoccomment">     *     return ConvertUtil.toInteger(pageNoString, 1);</em>
<a class="jxr_linenumber" name="L379" href="#L379">379</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L380" href="#L380">380</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L381" href="#L381">381</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L382" href="#L382">382</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L383" href="#L383">383</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L384" href="#L384">384</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L385" href="#L385">385</a> <em class="jxr_javadoccomment">     *            值</em>
<a class="jxr_linenumber" name="L386" href="#L386">386</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回 null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L387" href="#L387">387</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L388" href="#L388">388</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L389" href="#L389">389</a> <em class="jxr_javadoccomment">     *         如果找不到转换器或者转换的时候出现了异常,返回 null</em>
<a class="jxr_linenumber" name="L390" href="#L390">390</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.IntegerConverter</em>
<a class="jxr_linenumber" name="L391" href="#L391">391</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.math.NumberUtils#toInt(String)</em>
<a class="jxr_linenumber" name="L392" href="#L392">392</a> <em class="jxr_javadoccomment">     * @see #toInteger(Object, Integer)</em>
<a class="jxr_linenumber" name="L393" href="#L393">393</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L394" href="#L394">394</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Integer toInteger(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L395" href="#L395">395</a>         <strong class="jxr_keyword">return</strong> toInteger(toBeConvertedValue, <strong class="jxr_keyword">null</strong>);
<a class="jxr_linenumber" name="L396" href="#L396">396</a>     }
<a class="jxr_linenumber" name="L397" href="#L397">397</a> 
<a class="jxr_linenumber" name="L398" href="#L398">398</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L399" href="#L399">399</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转换成 {@link Integer}类型,如果转换不了返回默认值 &lt;code&gt;defaultValue&lt;/code&gt;.</em>
<a class="jxr_linenumber" name="L400" href="#L400">400</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L401" href="#L401">401</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L402" href="#L402">402</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L403" href="#L403">403</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L404" href="#L404">404</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L405" href="#L405">405</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L406" href="#L406">406</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(null,null)               = null</em>
<a class="jxr_linenumber" name="L407" href="#L407">407</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(null,1)                  = 1</em>
<a class="jxr_linenumber" name="L408" href="#L408">408</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger("aaaa",1)                = 1</em>
<a class="jxr_linenumber" name="L409" href="#L409">409</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(8L,1)                    = 8</em>
<a class="jxr_linenumber" name="L410" href="#L410">410</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger("8",1)                   = 8</em>
<a class="jxr_linenumber" name="L411" href="#L411">411</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(new BigDecimal("8"),1)   = 8</em>
<a class="jxr_linenumber" name="L412" href="#L412">412</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L413" href="#L413">413</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L414" href="#L414">414</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L415" href="#L415">415</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} L227:</em>
<a class="jxr_linenumber" name="L416" href="#L416">416</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L417" href="#L417">417</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L418" href="#L418">418</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L419" href="#L419">419</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(new String[] { "1", "2", "3" }, 8) = 1</em>
<a class="jxr_linenumber" name="L420" href="#L420">420</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L421" href="#L421">421</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L422" href="#L422">422</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L423" href="#L423">423</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} Line234:</em>
<a class="jxr_linenumber" name="L424" href="#L424">424</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L425" href="#L425">425</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L426" href="#L426">426</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L427" href="#L427">427</a> <em class="jxr_javadoccomment">     * ConvertUtil.toInteger(toList("1", "2"), 8) = 1</em>
<a class="jxr_linenumber" name="L428" href="#L428">428</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L429" href="#L429">429</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L430" href="#L430">430</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L431" href="#L431">431</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L432" href="#L432">432</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L433" href="#L433">433</a> <em class="jxr_javadoccomment">     * 该方法非常适用 获取request请求的分页参数</em>
<a class="jxr_linenumber" name="L434" href="#L434">434</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L435" href="#L435">435</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L436" href="#L436">436</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L437" href="#L437">437</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L438" href="#L438">438</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L439" href="#L439">439</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L440" href="#L440">440</a> <em class="jxr_javadoccomment">     * 原来的写法:</em>
<a class="jxr_linenumber" name="L441" href="#L441">441</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L442" href="#L442">442</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L443" href="#L443">443</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L444" href="#L444">444</a> <em class="jxr_javadoccomment">     * public static Integer getCurrentPageNo(HttpServletRequest request,String pageParamName){</em>
<a class="jxr_linenumber" name="L445" href="#L445">445</a> <em class="jxr_javadoccomment">     *     String pageNoString = RequestUtil.getParameter(request, pageParamName);</em>
<a class="jxr_linenumber" name="L446" href="#L446">446</a> <em class="jxr_javadoccomment">     *     try{</em>
<a class="jxr_linenumber" name="L447" href="#L447">447</a> <em class="jxr_javadoccomment">     *         int pageNo = Integer.parseInt(pageNoString);</em>
<a class="jxr_linenumber" name="L448" href="#L448">448</a> <em class="jxr_javadoccomment">     *         return pageNo;</em>
<a class="jxr_linenumber" name="L449" href="#L449">449</a> <em class="jxr_javadoccomment">     *     }catch (Exception e){</em>
<a class="jxr_linenumber" name="L450" href="#L450">450</a> <em class="jxr_javadoccomment">     *         LOGGER.error(e.getClass().getName(), e);</em>
<a class="jxr_linenumber" name="L451" href="#L451">451</a> <em class="jxr_javadoccomment">     *     }</em>
<a class="jxr_linenumber" name="L452" href="#L452">452</a> <em class="jxr_javadoccomment">     *     return 1; &lt;span style="color:green"&gt;// 不带这个参数或者转换异常返回1&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L453" href="#L453">453</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L454" href="#L454">454</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L455" href="#L455">455</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L456" href="#L456">456</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L457" href="#L457">457</a> <em class="jxr_javadoccomment">     * 现在可以更改成:</em>
<a class="jxr_linenumber" name="L458" href="#L458">458</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L459" href="#L459">459</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L460" href="#L460">460</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L461" href="#L461">461</a> <em class="jxr_javadoccomment">     * public static Integer getCurrentPageNo(HttpServletRequest request,String pageParamName){</em>
<a class="jxr_linenumber" name="L462" href="#L462">462</a> <em class="jxr_javadoccomment">     *     String pageNoString = RequestUtil.getParameter(request, pageParamName);</em>
<a class="jxr_linenumber" name="L463" href="#L463">463</a> <em class="jxr_javadoccomment">     *     return ConvertUtil.toInteger(pageNoString, 1);</em>
<a class="jxr_linenumber" name="L464" href="#L464">464</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L465" href="#L465">465</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L466" href="#L466">466</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L467" href="#L467">467</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L468" href="#L468">468</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L469" href="#L469">469</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L470" href="#L470">470</a> <em class="jxr_javadoccomment">     *            值</em>
<a class="jxr_linenumber" name="L471" href="#L471">471</a> <em class="jxr_javadoccomment">     * @param defaultValue</em>
<a class="jxr_linenumber" name="L472" href="#L472">472</a> <em class="jxr_javadoccomment">     *            默认值</em>
<a class="jxr_linenumber" name="L473" href="#L473">473</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回 &lt;code&gt;defaultValue&lt;/code&gt; &lt;br&gt;</em>
<a class="jxr_linenumber" name="L474" href="#L474">474</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L475" href="#L475">475</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L476" href="#L476">476</a> <em class="jxr_javadoccomment">     *         如果找不到转换器或者转换的时候出现了异常,返回 &lt;code&gt;defaultValue&lt;/code&gt;</em>
<a class="jxr_linenumber" name="L477" href="#L477">477</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.IntegerConverter</em>
<a class="jxr_linenumber" name="L478" href="#L478">478</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.ObjectUtils#defaultIfNull(Object, Object)</em>
<a class="jxr_linenumber" name="L479" href="#L479">479</a> <em class="jxr_javadoccomment">     * @since 1.6.1</em>
<a class="jxr_linenumber" name="L480" href="#L480">480</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L481" href="#L481">481</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Integer toInteger(Object toBeConvertedValue,Integer defaultValue){
<a class="jxr_linenumber" name="L482" href="#L482">482</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> IntegerConverter(defaultValue).convert(Integer.<strong class="jxr_keyword">class</strong>, toBeConvertedValue);
<a class="jxr_linenumber" name="L483" href="#L483">483</a>     }
<a class="jxr_linenumber" name="L484" href="#L484">484</a> 
<a class="jxr_linenumber" name="L485" href="#L485">485</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L486" href="#L486">486</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转换成 {@link Long}类型.</em>
<a class="jxr_linenumber" name="L487" href="#L487">487</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L488" href="#L488">488</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L489" href="#L489">489</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L490" href="#L490">490</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L491" href="#L491">491</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L492" href="#L492">492</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L493" href="#L493">493</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong(null)                     = null</em>
<a class="jxr_linenumber" name="L494" href="#L494">494</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong("aaaa")                   = null</em>
<a class="jxr_linenumber" name="L495" href="#L495">495</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong(8)                        = 8L</em>
<a class="jxr_linenumber" name="L496" href="#L496">496</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong("8")                      = 8L</em>
<a class="jxr_linenumber" name="L497" href="#L497">497</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong(new BigDecimal("8"))      = 8L</em>
<a class="jxr_linenumber" name="L498" href="#L498">498</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L499" href="#L499">499</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L500" href="#L500">500</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L501" href="#L501">501</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} L227:</em>
<a class="jxr_linenumber" name="L502" href="#L502">502</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L503" href="#L503">503</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L504" href="#L504">504</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L505" href="#L505">505</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong(new String[] { "1", "2", "3" }) = 1L</em>
<a class="jxr_linenumber" name="L506" href="#L506">506</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L507" href="#L507">507</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L508" href="#L508">508</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L509" href="#L509">509</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} Line234:</em>
<a class="jxr_linenumber" name="L510" href="#L510">510</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L511" href="#L511">511</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L512" href="#L512">512</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L513" href="#L513">513</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLong(toList("1", "2")) = 1L</em>
<a class="jxr_linenumber" name="L514" href="#L514">514</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L515" href="#L515">515</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L516" href="#L516">516</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L517" href="#L517">517</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L518" href="#L518">518</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L519" href="#L519">519</a> <em class="jxr_javadoccomment">     *            包含数字的对象.</em>
<a class="jxr_linenumber" name="L520" href="#L520">520</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回 null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L521" href="#L521">521</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L522" href="#L522">522</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L523" href="#L523">523</a> <em class="jxr_javadoccomment">     *         如果找不到转换器或者转换的时候出现了异常,返回 null</em>
<a class="jxr_linenumber" name="L524" href="#L524">524</a> <em class="jxr_javadoccomment">     * @see #convert(Object, Class)</em>
<a class="jxr_linenumber" name="L525" href="#L525">525</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.LongConverter</em>
<a class="jxr_linenumber" name="L526" href="#L526">526</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.math.NumberUtils#toLong(String)</em>
<a class="jxr_linenumber" name="L527" href="#L527">527</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L528" href="#L528">528</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Long toLong(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L529" href="#L529">529</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> LongConverter(<strong class="jxr_keyword">null</strong>).convert(Long.<strong class="jxr_keyword">class</strong>, toBeConvertedValue);
<a class="jxr_linenumber" name="L530" href="#L530">530</a>     }
<a class="jxr_linenumber" name="L531" href="#L531">531</a> 
<a class="jxr_linenumber" name="L532" href="#L532">532</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L533" href="#L533">533</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转换成 {@link java.math.BigDecimal}.</em>
<a class="jxr_linenumber" name="L534" href="#L534">534</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L535" href="#L535">535</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L536" href="#L536">536</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L537" href="#L537">537</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L538" href="#L538">538</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L539" href="#L539">539</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L540" href="#L540">540</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal(null)                     = null</em>
<a class="jxr_linenumber" name="L541" href="#L541">541</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal("aaaa")                   = null</em>
<a class="jxr_linenumber" name="L542" href="#L542">542</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal(8)                        = BigDecimal.valueOf(8)</em>
<a class="jxr_linenumber" name="L543" href="#L543">543</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal("8")                      = BigDecimal.valueOf(8)</em>
<a class="jxr_linenumber" name="L544" href="#L544">544</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal(new BigDecimal("8"))      = BigDecimal.valueOf(8)</em>
<a class="jxr_linenumber" name="L545" href="#L545">545</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L546" href="#L546">546</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L547" href="#L547">547</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L548" href="#L548">548</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} L227:</em>
<a class="jxr_linenumber" name="L549" href="#L549">549</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L550" href="#L550">550</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L551" href="#L551">551</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L552" href="#L552">552</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal(new String[] { "1", "2", "3" }) = BigDecimal.valueOf(1)</em>
<a class="jxr_linenumber" name="L553" href="#L553">553</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L554" href="#L554">554</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L555" href="#L555">555</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L556" href="#L556">556</a> <em class="jxr_javadoccomment">     * 如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换,参见 {@link AbstractConverter#convertArray(Object)} Line234:</em>
<a class="jxr_linenumber" name="L557" href="#L557">557</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L558" href="#L558">558</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L559" href="#L559">559</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L560" href="#L560">560</a> <em class="jxr_javadoccomment">     * ConvertUtil.toBigDecimal(toList("1", "2")) = BigDecimal.valueOf(1)</em>
<a class="jxr_linenumber" name="L561" href="#L561">561</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L562" href="#L562">562</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L563" href="#L563">563</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L564" href="#L564">564</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L565" href="#L565">565</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;{@link java.lang.Double} 转成 {@link java.math.BigDecimal}注意点:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L566" href="#L566">566</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L567" href="#L567">567</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L568" href="#L568">568</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L569" href="#L569">569</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L570" href="#L570">570</a> <em class="jxr_javadoccomment">     * &lt;span style="color:red"&gt;推荐使用 {@link BigDecimal#valueOf(double)}&lt;/span&gt;,不建议使用 &lt;code&gt;new BigDecimal(double)&lt;/code&gt;,参见 JDK API&lt;br&gt;</em>
<a class="jxr_linenumber" name="L571" href="#L571">571</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L572" href="#L572">572</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L573" href="#L573">573</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L574" href="#L574">574</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@code new BigDecimal(0.1) ====&gt; 0.1000000000000000055511151231257827021181583404541015625}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L575" href="#L575">575</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@code BigDecimal.valueOf(0.1) ====&gt; 0.1}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L576" href="#L576">576</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L577" href="#L577">577</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L578" href="#L578">578</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L579" href="#L579">579</a> <em class="jxr_javadoccomment">     * 本方法底层调用的是 {@link NumberConverter#toNumber(Class, Class, Number)</em>
<a class="jxr_linenumber" name="L580" href="#L580">580</a> <em class="jxr_javadoccomment">     * NumberConverter#toNumber(Class, Class, Number)},正确的处理了 {@link java.lang.Double} 转成 {@link java.math.BigDecimal}</em>
<a class="jxr_linenumber" name="L581" href="#L581">581</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L582" href="#L582">582</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L583" href="#L583">583</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L584" href="#L584">584</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L585" href="#L585">585</a> <em class="jxr_javadoccomment">     *            值</em>
<a class="jxr_linenumber" name="L586" href="#L586">586</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回 null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L587" href="#L587">587</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;数组&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L588" href="#L588">588</a> <em class="jxr_javadoccomment">     *         如果传入的参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是 &lt;b&gt;集合&lt;/b&gt;,那么&lt;b&gt;取第一个元素&lt;/b&gt;进行转换&lt;br&gt;</em>
<a class="jxr_linenumber" name="L589" href="#L589">589</a> <em class="jxr_javadoccomment">     *         如果找不到转换器或者转换的时候出现了异常,返回 null</em>
<a class="jxr_linenumber" name="L590" href="#L590">590</a> <em class="jxr_javadoccomment">     * @see #convert(Object, Class)</em>
<a class="jxr_linenumber" name="L591" href="#L591">591</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.NumberConverter#toNumber(Class, Class, Number)</em>
<a class="jxr_linenumber" name="L592" href="#L592">592</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.BigDecimalConverter</em>
<a class="jxr_linenumber" name="L593" href="#L593">593</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L594" href="#L594">594</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> BigDecimal toBigDecimal(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L595" href="#L595">595</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> BigDecimalConverter(<strong class="jxr_keyword">null</strong>).convert(BigDecimal.<strong class="jxr_keyword">class</strong>, toBeConvertedValue);
<a class="jxr_linenumber" name="L596" href="#L596">596</a>     }
<a class="jxr_linenumber" name="L597" href="#L597">597</a> 
<a class="jxr_linenumber" name="L598" href="#L598">598</a>     <em class="jxr_comment">//*********************数组***************************************************************************************</em>
<a class="jxr_linenumber" name="L599" href="#L599">599</a> 
<a class="jxr_linenumber" name="L600" href="#L600">600</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L601" href="#L601">601</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转成{@link Integer} 数组.</em>
<a class="jxr_linenumber" name="L602" href="#L602">602</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L603" href="#L603">603</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L604" href="#L604">604</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L605" href="#L605">605</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L606" href="#L606">606</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L607" href="#L607">607</a> <em class="jxr_javadoccomment">     * 核心实现,参见 {@link ArrayConverter#convertToType(Class, Object)}</em>
<a class="jxr_linenumber" name="L608" href="#L608">608</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L609" href="#L609">609</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L610" href="#L610">610</a> <em class="jxr_javadoccomment">     * &lt;dl&gt;</em>
<a class="jxr_linenumber" name="L611" href="#L611">611</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;如果参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt;是 &lt;code&gt;数组&lt;/code&gt; 或者 {@link Collection}&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L612" href="#L612">612</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L613" href="#L613">613</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;</em>
<a class="jxr_linenumber" name="L614" href="#L614">614</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L615" href="#L615">615</a> <em class="jxr_javadoccomment">     * 参见{@link org.apache.commons.beanutils.converters.ArrayConverter#convertToType(Class, Object)</em>
<a class="jxr_linenumber" name="L616" href="#L616">616</a> <em class="jxr_javadoccomment">     * ArrayConverter#convertToType(Class,Object)}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L617" href="#L617">617</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L618" href="#L618">618</a> <em class="jxr_javadoccomment">     * 会构造一个&lt;code&gt;Integer&lt;/code&gt;数组,长度就是 &lt;code&gt;toBeConvertedValue&lt;/code&gt;的大小或者长度,然后迭代&lt;code&gt;toBeConvertedValue&lt;/code&gt;依次逐个进行转换</em>
<a class="jxr_linenumber" name="L619" href="#L619">619</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L620" href="#L620">620</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L621" href="#L621">621</a> <em class="jxr_javadoccomment">     * &lt;h4&gt;示例:&lt;/h4&gt;</em>
<a class="jxr_linenumber" name="L622" href="#L622">622</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L623" href="#L623">623</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L624" href="#L624">624</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers(new String[] { "1", "2", "3" })       = [1,2,3]</em>
<a class="jxr_linenumber" name="L625" href="#L625">625</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers(toList("1", "2", "3"))    = [1,2,3]</em>
<a class="jxr_linenumber" name="L626" href="#L626">626</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L627" href="#L627">627</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L628" href="#L628">628</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L629" href="#L629">629</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L630" href="#L630">630</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;如果参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt;不是&lt;code&gt;数组&lt;/code&gt;也不是{@link Collection}&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L631" href="#L631">631</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L632" href="#L632">632</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;</em>
<a class="jxr_linenumber" name="L633" href="#L633">633</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L634" href="#L634">634</a> <em class="jxr_javadoccomment">     * 那么首先会调用 {@link ArrayConverter#convertToCollection(Class, Object)} 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt;转成集合,转换逻辑参见</em>
<a class="jxr_linenumber" name="L635" href="#L635">635</a> <em class="jxr_javadoccomment">     * {@link ArrayConverter#convertToCollection(Class, Object)}:</em>
<a class="jxr_linenumber" name="L636" href="#L636">636</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L637" href="#L637">637</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L638" href="#L638">638</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L639" href="#L639">639</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt;是{@link Number}, {@link Boolean} 或者 {@link java.util.Date} ,那么构造只有一个</em>
<a class="jxr_linenumber" name="L640" href="#L640">640</a> <em class="jxr_javadoccomment">     * &lt;code&gt;toBeConvertedValue&lt;/code&gt; 元素的 List返回.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L641" href="#L641">641</a> <em class="jxr_javadoccomment">     * &lt;li&gt;其他类型将转成字符串,然后调用 {@link ArrayConverter#parseElements(Class, String)}转成list.</em>
<a class="jxr_linenumber" name="L642" href="#L642">642</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L643" href="#L643">643</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L644" href="#L644">644</a> <em class="jxr_javadoccomment">     * 具体转换逻辑为:</em>
<a class="jxr_linenumber" name="L645" href="#L645">645</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L646" href="#L646">646</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L647" href="#L647">647</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L648" href="#L648">648</a> <em class="jxr_javadoccomment">     * &lt;li&gt;字符串期望是一个逗号分隔的字符串.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L649" href="#L649">649</a> <em class="jxr_javadoccomment">     * &lt;li&gt;字符串可以被'{' 开头 和 '}'结尾的分隔符包裹,程序内部会自动截取.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L650" href="#L650">650</a> <em class="jxr_javadoccomment">     * &lt;li&gt;会去除前后空白.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L651" href="#L651">651</a> <em class="jxr_javadoccomment">     * &lt;li&gt;Elements in the list may be delimited by single or double quotes. Within a quoted elements, the normal Java escape sequences are</em>
<a class="jxr_linenumber" name="L652" href="#L652">652</a> <em class="jxr_javadoccomment">     * valid.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L653" href="#L653">653</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L654" href="#L654">654</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L655" href="#L655">655</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L656" href="#L656">656</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L657" href="#L657">657</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L658" href="#L658">658</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L659" href="#L659">659</a> <em class="jxr_javadoccomment">     * 得到list之后,会构造一个&lt;code&gt;Integer&lt;/code&gt;数组,长度就是 &lt;code&gt;toBeConvertedValue&lt;/code&gt;的大小或者长度,然后迭代&lt;code&gt;toBeConvertedValue&lt;/code&gt;依次逐个进行转换</em>
<a class="jxr_linenumber" name="L660" href="#L660">660</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L661" href="#L661">661</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L662" href="#L662">662</a> <em class="jxr_javadoccomment">     * &lt;h4&gt;示例:&lt;/h4&gt;</em>
<a class="jxr_linenumber" name="L663" href="#L663">663</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L664" href="#L664">664</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L665" href="#L665">665</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers("1,2,3")                  = new Integer[] { 1, 2, 3 }</em>
<a class="jxr_linenumber" name="L666" href="#L666">666</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers("{1,2,3}")                = new Integer[] { 1, 2, 3 }</em>
<a class="jxr_linenumber" name="L667" href="#L667">667</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers("{ 1 ,2,3}")              = new Integer[] { 1, 2, 3 }</em>
<a class="jxr_linenumber" name="L668" href="#L668">668</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers("1,2, 3")                 = new Integer[] { 1, 2, 3 }</em>
<a class="jxr_linenumber" name="L669" href="#L669">669</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers("1,2 , 3")                = new Integer[] { 1, 2, 3 }</em>
<a class="jxr_linenumber" name="L670" href="#L670">670</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L671" href="#L671">671</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L672" href="#L672">672</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L673" href="#L673">673</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L674" href="#L674">674</a> <em class="jxr_javadoccomment">     * &lt;/dl&gt;</em>
<a class="jxr_linenumber" name="L675" href="#L675">675</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L676" href="#L676">676</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L677" href="#L677">677</a> <em class="jxr_javadoccomment">     * 每个元素转换成 Integer的时候,会调用</em>
<a class="jxr_linenumber" name="L678" href="#L678">678</a> <em class="jxr_javadoccomment">     * {@link org.apache.commons.beanutils.converters.NumberConverter#convertToType(Class, Object)},具体的规则是:</em>
<a class="jxr_linenumber" name="L679" href="#L679">679</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L680" href="#L680">680</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L681" href="#L681">681</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L682" href="#L682">682</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L683" href="#L683">683</a> <em class="jxr_javadoccomment">     * &lt;dl&gt;</em>
<a class="jxr_linenumber" name="L684" href="#L684">684</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;1.如果 元素是 Number类型&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L685" href="#L685">685</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;那么会调用 {@link org.apache.commons.beanutils.converters.NumberConverter#toNumber(Class, Class, Number)}&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L686" href="#L686">686</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L687" href="#L687">687</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;2.如果 元素是 Boolean类型&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L688" href="#L688">688</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;那么 true被转成1,false 转成 0&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L689" href="#L689">689</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L690" href="#L690">690</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;3.其他情况&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L691" href="#L691">691</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;将元素转成字符串,并trim,再进行转换&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L692" href="#L692">692</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L693" href="#L693">693</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;4.元素是null的情况&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L694" href="#L694">694</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;如果有元素是null,那么会调用 {@link org.apache.commons.beanutils.converters.AbstractConverter#convert(Class, Object)},会调用</em>
<a class="jxr_linenumber" name="L695" href="#L695">695</a> <em class="jxr_javadoccomment">     * {@link org.apache.commons.beanutils.converters.AbstractConverter#handleMissing(Class)} 方法,没有默认值的话,会抛出异常,然后catch之后返回 empty Integer 数组</em>
<a class="jxr_linenumber" name="L696" href="#L696">696</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L697" href="#L697">697</a> <em class="jxr_javadoccomment">     * &lt;/dl&gt;</em>
<a class="jxr_linenumber" name="L698" href="#L698">698</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L699" href="#L699">699</a> <em class="jxr_javadoccomment">     * &lt;h4&gt;示例:&lt;/h4&gt;</em>
<a class="jxr_linenumber" name="L700" href="#L700">700</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L701" href="#L701">701</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L702" href="#L702">702</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers(toList("1", "2", &lt;span style="color:red"&gt;" 3"&lt;/span&gt;))        = new Integer[] { 1, 2, 3 }</em>
<a class="jxr_linenumber" name="L703" href="#L703">703</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers(toArray(true, false, false))                                  = new Integer[] { 1, 0, 0 }</em>
<a class="jxr_linenumber" name="L704" href="#L704">704</a> <em class="jxr_javadoccomment">     * ConvertUtil.toIntegers(new String[] { "1", null, "2", "3" })                         = new Integer[] {}</em>
<a class="jxr_linenumber" name="L705" href="#L705">705</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L706" href="#L706">706</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L707" href="#L707">707</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L708" href="#L708">708</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L709" href="#L709">709</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L710" href="#L710">710</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L711" href="#L711">711</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L712" href="#L712">712</a> <em class="jxr_javadoccomment">     *            需要被转换的值</em>
<a class="jxr_linenumber" name="L713" href="#L713">713</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回 null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L714" href="#L714">714</a> <em class="jxr_javadoccomment">     * @see #convert(Object, Class)</em>
<a class="jxr_linenumber" name="L715" href="#L715">715</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.ArrayConverter</em>
<a class="jxr_linenumber" name="L716" href="#L716">716</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L717" href="#L717">717</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Integer[] toIntegers(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L718" href="#L718">718</a>         <strong class="jxr_keyword">return</strong> convert(toBeConvertedValue, Integer[].<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="L719" href="#L719">719</a>     }
<a class="jxr_linenumber" name="L720" href="#L720">720</a> 
<a class="jxr_linenumber" name="L721" href="#L721">721</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L722" href="#L722">722</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转成Long 数组.</em>
<a class="jxr_linenumber" name="L723" href="#L723">723</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L724" href="#L724">724</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L725" href="#L725">725</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L726" href="#L726">726</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L727" href="#L727">727</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L728" href="#L728">728</a> <em class="jxr_javadoccomment">     * 核心实现,参见 {@link ArrayConverter#convertToType(Class, Object)}</em>
<a class="jxr_linenumber" name="L729" href="#L729">729</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L730" href="#L730">730</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L731" href="#L731">731</a> <em class="jxr_javadoccomment">     * &lt;dl&gt;</em>
<a class="jxr_linenumber" name="L732" href="#L732">732</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;如果参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt;是 &lt;code&gt;数组&lt;/code&gt; 或者 {@link Collection}&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L733" href="#L733">733</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L734" href="#L734">734</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;</em>
<a class="jxr_linenumber" name="L735" href="#L735">735</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L736" href="#L736">736</a> <em class="jxr_javadoccomment">     * 参见{@link org.apache.commons.beanutils.converters.ArrayConverter#convertToType(Class, Object)</em>
<a class="jxr_linenumber" name="L737" href="#L737">737</a> <em class="jxr_javadoccomment">     * ArrayConverter#convertToType(Class,Object)}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L738" href="#L738">738</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L739" href="#L739">739</a> <em class="jxr_javadoccomment">     * 会构造一个&lt;code&gt;Long&lt;/code&gt;数组,长度就是 &lt;code&gt;toBeConvertedValue&lt;/code&gt;的大小或者长度,然后迭代&lt;code&gt;toBeConvertedValue&lt;/code&gt;依次逐个进行转换</em>
<a class="jxr_linenumber" name="L740" href="#L740">740</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L741" href="#L741">741</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L742" href="#L742">742</a> <em class="jxr_javadoccomment">     * &lt;h4&gt;示例:&lt;/h4&gt;</em>
<a class="jxr_linenumber" name="L743" href="#L743">743</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L744" href="#L744">744</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L745" href="#L745">745</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs(new String[] { "1", "2", "3" }       = [1L,2L,3L]</em>
<a class="jxr_linenumber" name="L746" href="#L746">746</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs(toList("1", "2", "3"))               = [1L,2L,3L]</em>
<a class="jxr_linenumber" name="L747" href="#L747">747</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L748" href="#L748">748</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L749" href="#L749">749</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L750" href="#L750">750</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L751" href="#L751">751</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;如果参数 &lt;code&gt;toBeConvertedValue&lt;/code&gt;不是&lt;code&gt;数组&lt;/code&gt;也不是{@link Collection}&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L752" href="#L752">752</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L753" href="#L753">753</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;</em>
<a class="jxr_linenumber" name="L754" href="#L754">754</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L755" href="#L755">755</a> <em class="jxr_javadoccomment">     * 那么首先会调用 {@link ArrayConverter#convertToCollection(Class, Object)} 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt;转成集合,转换逻辑参见</em>
<a class="jxr_linenumber" name="L756" href="#L756">756</a> <em class="jxr_javadoccomment">     * {@link ArrayConverter#convertToCollection(Class, Object)}:</em>
<a class="jxr_linenumber" name="L757" href="#L757">757</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L758" href="#L758">758</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L759" href="#L759">759</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L760" href="#L760">760</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt;是{@link Number}, {@link Boolean} 或者 {@link java.util.Date} ,那么构造只有一个</em>
<a class="jxr_linenumber" name="L761" href="#L761">761</a> <em class="jxr_javadoccomment">     * &lt;code&gt;toBeConvertedValue&lt;/code&gt; 元素的 List返回.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L762" href="#L762">762</a> <em class="jxr_javadoccomment">     * &lt;li&gt;其他类型将转成字符串,然后调用 {@link ArrayConverter#parseElements(Class, String)}转成list.</em>
<a class="jxr_linenumber" name="L763" href="#L763">763</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L764" href="#L764">764</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L765" href="#L765">765</a> <em class="jxr_javadoccomment">     * 具体转换逻辑为:</em>
<a class="jxr_linenumber" name="L766" href="#L766">766</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L767" href="#L767">767</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L768" href="#L768">768</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L769" href="#L769">769</a> <em class="jxr_javadoccomment">     * &lt;li&gt;字符串期望是一个逗号分隔的字符串.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L770" href="#L770">770</a> <em class="jxr_javadoccomment">     * &lt;li&gt;字符串可以被'{' 开头 和 '}'结尾的分隔符包裹,程序内部会自动截取.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L771" href="#L771">771</a> <em class="jxr_javadoccomment">     * &lt;li&gt;会去除前后空白.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L772" href="#L772">772</a> <em class="jxr_javadoccomment">     * &lt;li&gt;Elements in the list may be delimited by single or double quotes. Within a quoted elements, the normal Java escape sequences are</em>
<a class="jxr_linenumber" name="L773" href="#L773">773</a> <em class="jxr_javadoccomment">     * valid.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L774" href="#L774">774</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L775" href="#L775">775</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L776" href="#L776">776</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L777" href="#L777">777</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L778" href="#L778">778</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L779" href="#L779">779</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L780" href="#L780">780</a> <em class="jxr_javadoccomment">     * 得到list之后,会构造一个&lt;code&gt;Long&lt;/code&gt;数组,长度就是 &lt;code&gt;toBeConvertedValue&lt;/code&gt;的大小或者长度,然后迭代&lt;code&gt;toBeConvertedValue&lt;/code&gt;依次逐个进行转换</em>
<a class="jxr_linenumber" name="L781" href="#L781">781</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L782" href="#L782">782</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L783" href="#L783">783</a> <em class="jxr_javadoccomment">     * &lt;h4&gt;示例:&lt;/h4&gt;</em>
<a class="jxr_linenumber" name="L784" href="#L784">784</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L785" href="#L785">785</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L786" href="#L786">786</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs("1,2,3")                  = new Long[] { 1L, 2L, 3L }</em>
<a class="jxr_linenumber" name="L787" href="#L787">787</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs("{1,2,3}")                = new Long[] { 1L, 2L, 3L }</em>
<a class="jxr_linenumber" name="L788" href="#L788">788</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs("{ 1 ,2,3}")              = new Long[] { 1L, 2L, 3L }</em>
<a class="jxr_linenumber" name="L789" href="#L789">789</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs("1,2, 3")                 = new Long[] { 1L, 2L, 3L }</em>
<a class="jxr_linenumber" name="L790" href="#L790">790</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs("1,2 , 3")                = new Long[] { 1L, 2L, 3L }</em>
<a class="jxr_linenumber" name="L791" href="#L791">791</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L792" href="#L792">792</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L793" href="#L793">793</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L794" href="#L794">794</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L795" href="#L795">795</a> <em class="jxr_javadoccomment">     * &lt;/dl&gt;</em>
<a class="jxr_linenumber" name="L796" href="#L796">796</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L797" href="#L797">797</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L798" href="#L798">798</a> <em class="jxr_javadoccomment">     * 每个元素转换成 Integer的时候,会调用</em>
<a class="jxr_linenumber" name="L799" href="#L799">799</a> <em class="jxr_javadoccomment">     * {@link org.apache.commons.beanutils.converters.NumberConverter#convertToType(Class, Object)},具体的规则是:</em>
<a class="jxr_linenumber" name="L800" href="#L800">800</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L801" href="#L801">801</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L802" href="#L802">802</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L803" href="#L803">803</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L804" href="#L804">804</a> <em class="jxr_javadoccomment">     * &lt;dl&gt;</em>
<a class="jxr_linenumber" name="L805" href="#L805">805</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;1.如果 元素是 Number类型&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L806" href="#L806">806</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;那么会调用 {@link org.apache.commons.beanutils.converters.NumberConverter#toNumber(Class, Class, Number)}&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L807" href="#L807">807</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L808" href="#L808">808</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;2.如果 元素是 Boolean类型&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L809" href="#L809">809</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;那么 true被转成1L,false 转成 0L&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L810" href="#L810">810</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L811" href="#L811">811</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;3.其他情况&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L812" href="#L812">812</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;将元素转成字符串,并trim,再进行转换&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L813" href="#L813">813</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L814" href="#L814">814</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;4.元素是null的情况&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L815" href="#L815">815</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;如果有元素是null,那么会调用 {@link org.apache.commons.beanutils.converters.AbstractConverter#convert(Class, Object)},会调用</em>
<a class="jxr_linenumber" name="L816" href="#L816">816</a> <em class="jxr_javadoccomment">     * {@link org.apache.commons.beanutils.converters.AbstractConverter#handleMissing(Class)} 方法,没有默认值的话,会抛出异常,然后catch之后返回 empty Integer 数组</em>
<a class="jxr_linenumber" name="L817" href="#L817">817</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L818" href="#L818">818</a> <em class="jxr_javadoccomment">     * &lt;/dl&gt;</em>
<a class="jxr_linenumber" name="L819" href="#L819">819</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L820" href="#L820">820</a> <em class="jxr_javadoccomment">     * &lt;h4&gt;示例:&lt;/h4&gt;</em>
<a class="jxr_linenumber" name="L821" href="#L821">821</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L822" href="#L822">822</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L823" href="#L823">823</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs(toList("1", "2", &lt;span style="color:red"&gt;" 3"&lt;/span&gt;))        = new Long[] { 1L, 2L, 3L }</em>
<a class="jxr_linenumber" name="L824" href="#L824">824</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs(toArray(true, false, false))                                  = new Long[] { 1L, 0L, 0L }</em>
<a class="jxr_linenumber" name="L825" href="#L825">825</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLongs(new String[] { "1", null, "2", "3" })                         = new Long[] {}</em>
<a class="jxr_linenumber" name="L826" href="#L826">826</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L827" href="#L827">827</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L828" href="#L828">828</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L829" href="#L829">829</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L830" href="#L830">830</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L831" href="#L831">831</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L832" href="#L832">832</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;特别适合以下形式的代码:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L833" href="#L833">833</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L834" href="#L834">834</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L835" href="#L835">835</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L836" href="#L836">836</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L837" href="#L837">837</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L838" href="#L838">838</a> <em class="jxr_javadoccomment">     * protected long[] getOrderIdLongs(String orderIds){</em>
<a class="jxr_linenumber" name="L839" href="#L839">839</a> <em class="jxr_javadoccomment">     *     &lt;span style="color:green"&gt;// 确认交易时候插入数据库的时候,不应该会出现空的情况&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L840" href="#L840">840</a> <em class="jxr_javadoccomment">     *     String[] orderIdArray = orderIds.split(",");</em>
<a class="jxr_linenumber" name="L841" href="#L841">841</a> <em class="jxr_javadoccomment">     *     int orderLength = orderIdArray.length;</em>
<a class="jxr_linenumber" name="L842" href="#L842">842</a> <em class="jxr_javadoccomment">     *     long[] ids = new long[orderLength];</em>
<a class="jxr_linenumber" name="L843" href="#L843">843</a> <em class="jxr_javadoccomment">     *     for (int i = 0, j = orderLength; i {@code &lt;} j; ++i){</em>
<a class="jxr_linenumber" name="L844" href="#L844">844</a> <em class="jxr_javadoccomment">     *         ids[i] = Long.parseLong(orderIdArray[i]);</em>
<a class="jxr_linenumber" name="L845" href="#L845">845</a> <em class="jxr_javadoccomment">     *     }</em>
<a class="jxr_linenumber" name="L846" href="#L846">846</a> <em class="jxr_javadoccomment">     *     return ids;</em>
<a class="jxr_linenumber" name="L847" href="#L847">847</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L848" href="#L848">848</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L849" href="#L849">849</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L850" href="#L850">850</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L851" href="#L851">851</a> <em class="jxr_javadoccomment">     * &lt;b&gt;可以重构成:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L852" href="#L852">852</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L853" href="#L853">853</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L854" href="#L854">854</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L855" href="#L855">855</a> <em class="jxr_javadoccomment">     * protected long[] getOrderIdLongs(String orderIds){</em>
<a class="jxr_linenumber" name="L856" href="#L856">856</a> <em class="jxr_javadoccomment">     *     return toLongs(orderIds);</em>
<a class="jxr_linenumber" name="L857" href="#L857">857</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L858" href="#L858">858</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L859" href="#L859">859</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L860" href="#L860">860</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L861" href="#L861">861</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L862" href="#L862">862</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L863" href="#L863">863</a> <em class="jxr_javadoccomment">     *            the to be converted value</em>
<a class="jxr_linenumber" name="L864" href="#L864">864</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回 null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L865" href="#L865">865</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.ConvertUtils#convert(Object, Class)</em>
<a class="jxr_linenumber" name="L866" href="#L866">866</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.ArrayConverter</em>
<a class="jxr_linenumber" name="L867" href="#L867">867</a> <em class="jxr_javadoccomment">     * @see #convert(Object, Class)</em>
<a class="jxr_linenumber" name="L868" href="#L868">868</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L869" href="#L869">869</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Long[] toLongs(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L870" href="#L870">870</a>         <strong class="jxr_keyword">return</strong> convert(toBeConvertedValue, Long[].<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="L871" href="#L871">871</a>     }
<a class="jxr_linenumber" name="L872" href="#L872">872</a>     <em class="jxr_comment">//*************************************************************************************************</em>
<a class="jxr_linenumber" name="L873" href="#L873">873</a> 
<a class="jxr_linenumber" name="L874" href="#L874">874</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L875" href="#L875">875</a> <em class="jxr_javadoccomment">     * 把对象 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转换成字符串.</em>
<a class="jxr_linenumber" name="L876" href="#L876">876</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L877" href="#L877">877</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L878" href="#L878">878</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L879" href="#L879">879</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L880" href="#L880">880</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L881" href="#L881">881</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L882" href="#L882">882</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(1)                  =   "1"</em>
<a class="jxr_linenumber" name="L883" href="#L883">883</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(toBigDecimal(1.0))  =   "1.0"</em>
<a class="jxr_linenumber" name="L884" href="#L884">884</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(toLong(8L))         =   "8"</em>
<a class="jxr_linenumber" name="L885" href="#L885">885</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L886" href="#L886">886</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L887" href="#L887">887</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L888" href="#L888">888</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L889" href="#L889">889</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;注意:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L890" href="#L890">890</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L891" href="#L891">891</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L892" href="#L892">892</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L893" href="#L893">893</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L894" href="#L894">894</a> <em class="jxr_javadoccomment">     * 该方法&lt;b&gt;不适合&lt;/b&gt; list转换成字符串,比如:</em>
<a class="jxr_linenumber" name="L895" href="#L895">895</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L896" href="#L896">896</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L897" href="#L897">897</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L898" href="#L898">898</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(toList("张飞", "关羽", "", "赵云")) = "张飞"</em>
<a class="jxr_linenumber" name="L899" href="#L899">899</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L900" href="#L900">900</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L901" href="#L901">901</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L902" href="#L902">902</a> <em class="jxr_javadoccomment">     * ,请使用 {@link #toString(Collection, ToStringConfig)}</em>
<a class="jxr_linenumber" name="L903" href="#L903">903</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L904" href="#L904">904</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L905" href="#L905">905</a> <em class="jxr_javadoccomment">     * &lt;hr&gt;</em>
<a class="jxr_linenumber" name="L906" href="#L906">906</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L907" href="#L907">907</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L908" href="#L908">908</a> <em class="jxr_javadoccomment">     * 该方法也&lt;b&gt;不适合&lt;/b&gt; array 转换成字符串,比如:</em>
<a class="jxr_linenumber" name="L909" href="#L909">909</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L910" href="#L910">910</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L911" href="#L911">911</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L912" href="#L912">912</a> <em class="jxr_javadoccomment">     * Integer[] int1 = { 2, null, 1, null };</em>
<a class="jxr_linenumber" name="L913" href="#L913">913</a> <em class="jxr_javadoccomment">     * LOGGER.debug(ConvertUtil.toString(int1));        = 2</em>
<a class="jxr_linenumber" name="L914" href="#L914">914</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L915" href="#L915">915</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L916" href="#L916">916</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L917" href="#L917">917</a> <em class="jxr_javadoccomment">     * 请使用 {@link #toString(Object[], ToStringConfig)}</em>
<a class="jxr_linenumber" name="L918" href="#L918">918</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L919" href="#L919">919</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L920" href="#L920">920</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L921" href="#L921">921</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L922" href="#L922">922</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;对于 Array 转成 String:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L923" href="#L923">923</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L924" href="#L924">924</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L925" href="#L925">925</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L926" href="#L926">926</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L927" href="#L927">927</a> <em class="jxr_javadoccomment">     * 参见 {@link org.apache.commons.beanutils.converters.ArrayConverter#convertToString(Object) ArrayConverter#convertToString(Object)} &lt;br&gt;</em>
<a class="jxr_linenumber" name="L928" href="#L928">928</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L929" href="#L929">929</a> <em class="jxr_javadoccomment">     * 在转换的过程中,如果发现object是数组,将使用 {@link java.lang.reflect.Array#get(Object, int) Array#get(Object, int)}来获得数据,&lt;br&gt;</em>
<a class="jxr_linenumber" name="L930" href="#L930">930</a> <em class="jxr_javadoccomment">     * 如果发现不是数组,将会将object转成集合 {@link org.apache.commons.beanutils.converters.ArrayConverter#convertToCollection(Class, Object)</em>
<a class="jxr_linenumber" name="L931" href="#L931">931</a> <em class="jxr_javadoccomment">     * ArrayConverter#convertToCollection(Class, Object)}再转成迭代器 {@link java.util.Collection#iterator() Collection.iterator()}</em>
<a class="jxr_linenumber" name="L932" href="#L932">932</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L933" href="#L933">933</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L934" href="#L934">934</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L935" href="#L935">935</a> <em class="jxr_javadoccomment">     * 在将object转成集合 {@link org.apache.commons.beanutils.converters.ArrayConverter#convertToCollection(Class, Object)</em>
<a class="jxr_linenumber" name="L936" href="#L936">936</a> <em class="jxr_javadoccomment">     * ArrayConverter#convertToCollection(Class, Object)}时候,有以下规则:</em>
<a class="jxr_linenumber" name="L937" href="#L937">937</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L938" href="#L938">938</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L939" href="#L939">939</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L940" href="#L940">940</a> <em class="jxr_javadoccomment">     * &lt;li&gt;The string is expected to be a comma-separated list of values.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L941" href="#L941">941</a> <em class="jxr_javadoccomment">     * &lt;li&gt;字符串可以被'{' and '}'分隔符包裹.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L942" href="#L942">942</a> <em class="jxr_javadoccomment">     * &lt;li&gt;去除前后空白.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L943" href="#L943">943</a> <em class="jxr_javadoccomment">     * &lt;li&gt;Elements in the list may be delimited by single or double quotes. Within a quoted elements, the normal Java escape sequences are</em>
<a class="jxr_linenumber" name="L944" href="#L944">944</a> <em class="jxr_javadoccomment">     * valid.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L945" href="#L945">945</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L946" href="#L946">946</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L947" href="#L947">947</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L948" href="#L948">948</a> <em class="jxr_javadoccomment">     * 默认:</em>
<a class="jxr_linenumber" name="L949" href="#L949">949</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L950" href="#L950">950</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L951" href="#L951">951</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L952" href="#L952">952</a> <em class="jxr_javadoccomment">     * &lt;table border="1" cellspacing="0" cellpadding="4" summary=""&gt;</em>
<a class="jxr_linenumber" name="L953" href="#L953">953</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L954" href="#L954">954</a> <em class="jxr_javadoccomment">     * &lt;tr style="background-color:#ccccff"&gt;</em>
<a class="jxr_linenumber" name="L955" href="#L955">955</a> <em class="jxr_javadoccomment">     * &lt;th align="left"&gt;字段&lt;/th&gt;</em>
<a class="jxr_linenumber" name="L956" href="#L956">956</a> <em class="jxr_javadoccomment">     * &lt;th align="left"&gt;说明&lt;/th&gt;</em>
<a class="jxr_linenumber" name="L957" href="#L957">957</a> <em class="jxr_javadoccomment">     * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L958" href="#L958">958</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L959" href="#L959">959</a> <em class="jxr_javadoccomment">     * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L960" href="#L960">960</a> <em class="jxr_javadoccomment">     * &lt;td&gt;int defaultSize&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L961" href="#L961">961</a> <em class="jxr_javadoccomment">     * &lt;td&gt;指定构建的默认数组的大小 or if less than zero indicates that a &lt;code&gt;null&lt;/code&gt; default value should be used.&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L962" href="#L962">962</a> <em class="jxr_javadoccomment">     * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L963" href="#L963">963</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L964" href="#L964">964</a> <em class="jxr_javadoccomment">     * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L965" href="#L965">965</a> <em class="jxr_javadoccomment">     * &lt;td&gt;char delimiter = ','&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L966" href="#L966">966</a> <em class="jxr_javadoccomment">     * &lt;td&gt;分隔符,转成的string中的元素分隔符&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L967" href="#L967">967</a> <em class="jxr_javadoccomment">     * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L968" href="#L968">968</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L969" href="#L969">969</a> <em class="jxr_javadoccomment">     * &lt;tr valign="top"&gt;</em>
<a class="jxr_linenumber" name="L970" href="#L970">970</a> <em class="jxr_javadoccomment">     * &lt;td&gt;char[] allowedChars = new char[] {'.', '-'}&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L971" href="#L971">971</a> <em class="jxr_javadoccomment">     * &lt;td&gt;用于{@link java.io.StreamTokenizer}分隔字符串&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L972" href="#L972">972</a> <em class="jxr_javadoccomment">     * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L973" href="#L973">973</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L974" href="#L974">974</a> <em class="jxr_javadoccomment">     * &lt;tr valign="top" style="background-color:#eeeeff"&gt;</em>
<a class="jxr_linenumber" name="L975" href="#L975">975</a> <em class="jxr_javadoccomment">     * &lt;td&gt;boolean onlyFirstToString = true;&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L976" href="#L976">976</a> <em class="jxr_javadoccomment">     * &lt;td&gt;只转第一个值&lt;/td&gt;</em>
<a class="jxr_linenumber" name="L977" href="#L977">977</a> <em class="jxr_javadoccomment">     * &lt;/tr&gt;</em>
<a class="jxr_linenumber" name="L978" href="#L978">978</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L979" href="#L979">979</a> <em class="jxr_javadoccomment">     * &lt;/table&gt;</em>
<a class="jxr_linenumber" name="L980" href="#L980">980</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L981" href="#L981">981</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L982" href="#L982">982</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L983" href="#L983">983</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L984" href="#L984">984</a> <em class="jxr_javadoccomment">     *            参数值</em>
<a class="jxr_linenumber" name="L985" href="#L985">985</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回null</em>
<a class="jxr_linenumber" name="L986" href="#L986">986</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.ArrayConverter#convertToString(Object)</em>
<a class="jxr_linenumber" name="L987" href="#L987">987</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.ConvertUtils#convert(Object)</em>
<a class="jxr_linenumber" name="L988" href="#L988">988</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.ConvertUtilsBean#convert(Object)</em>
<a class="jxr_linenumber" name="L989" href="#L989">989</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.StringConverter</em>
<a class="jxr_linenumber" name="L990" href="#L990">990</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L991" href="#L991">991</a> <em class="jxr_javadoccomment">     * @see java.util.Arrays#toString(Object[])</em>
<a class="jxr_linenumber" name="L992" href="#L992">992</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L993" href="#L993">993</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String toString(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L994" href="#L994">994</a>         <strong class="jxr_keyword">return</strong> convert(toBeConvertedValue, String.<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="L995" href="#L995">995</a>     }
<a class="jxr_linenumber" name="L996" href="#L996">996</a> 
<a class="jxr_linenumber" name="L997" href="#L997">997</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L998" href="#L998">998</a> <em class="jxr_javadoccomment">     * 将集合 &lt;code&gt;collection&lt;/code&gt; 使用拼接配置 toStringConfig 拼接成字符串.</em>
<a class="jxr_linenumber" name="L999" href="#L999">999</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1000" href="#L1000">1000</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1001" href="#L1001">1001</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1002" href="#L1002">1002</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1003" href="#L1003">1003</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1004" href="#L1004">1004</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1005" href="#L1005">1005</a> <em class="jxr_javadoccomment">     * List{@code &lt;String&gt;} list = new ArrayList{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L1006" href="#L1006">1006</a> <em class="jxr_javadoccomment">     * list.add("feilong");</em>
<a class="jxr_linenumber" name="L1007" href="#L1007">1007</a> <em class="jxr_javadoccomment">     * list.add("");</em>
<a class="jxr_linenumber" name="L1008" href="#L1008">1008</a> <em class="jxr_javadoccomment">     * list.add("xinge");</em>
<a class="jxr_linenumber" name="L1009" href="#L1009">1009</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1010" href="#L1010">1010</a> <em class="jxr_javadoccomment">     * ToStringConfig toStringConfig = new ToStringConfig(",");</em>
<a class="jxr_linenumber" name="L1011" href="#L1011">1011</a> <em class="jxr_javadoccomment">     * toStringConfig.setIsJoinNullOrEmpty(false);</em>
<a class="jxr_linenumber" name="L1012" href="#L1012">1012</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1013" href="#L1013">1013</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(list,toStringConfig);</em>
<a class="jxr_linenumber" name="L1014" href="#L1014">1014</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1015" href="#L1015">1015</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1016" href="#L1016">1016</a> <em class="jxr_javadoccomment">     * &lt;b&gt;输出:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1017" href="#L1017">1017</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1018" href="#L1018">1018</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1019" href="#L1019">1019</a> <em class="jxr_javadoccomment">     * feilong,xinge</em>
<a class="jxr_linenumber" name="L1020" href="#L1020">1020</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1021" href="#L1021">1021</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1022" href="#L1022">1022</a> <em class="jxr_javadoccomment">     * &lt;hr&gt;</em>
<a class="jxr_linenumber" name="L1023" href="#L1023">1023</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1024" href="#L1024">1024</a> <em class="jxr_javadoccomment">     * 你还可以使用这个方法来将集合&lt;b&gt;换行输出&lt;/b&gt;,比如:</em>
<a class="jxr_linenumber" name="L1025" href="#L1025">1025</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1026" href="#L1026">1026</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1027" href="#L1027">1027</a> <em class="jxr_javadoccomment">     * List{@code &lt;String&gt;} list = toList("飞龙", "小金", "四金", "金金金金");</em>
<a class="jxr_linenumber" name="L1028" href="#L1028">1028</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1029" href="#L1029">1029</a> <em class="jxr_javadoccomment">     * ToStringConfig toStringConfig = new ToStringConfig(SystemUtils.LINE_SEPARATOR);</em>
<a class="jxr_linenumber" name="L1030" href="#L1030">1030</a> <em class="jxr_javadoccomment">     * LOGGER.debug(ConvertUtil.toString(list, toStringConfig));</em>
<a class="jxr_linenumber" name="L1031" href="#L1031">1031</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1032" href="#L1032">1032</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1033" href="#L1033">1033</a> <em class="jxr_javadoccomment">     * &lt;b&gt;输出:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1034" href="#L1034">1034</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1035" href="#L1035">1035</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1036" href="#L1036">1036</a> <em class="jxr_javadoccomment">     * 飞龙</em>
<a class="jxr_linenumber" name="L1037" href="#L1037">1037</a> <em class="jxr_javadoccomment">     * 小金</em>
<a class="jxr_linenumber" name="L1038" href="#L1038">1038</a> <em class="jxr_javadoccomment">     * 四金</em>
<a class="jxr_linenumber" name="L1039" href="#L1039">1039</a> <em class="jxr_javadoccomment">     * 金金金金</em>
<a class="jxr_linenumber" name="L1040" href="#L1040">1040</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1041" href="#L1041">1041</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1042" href="#L1042">1042</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1043" href="#L1043">1043</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1044" href="#L1044">1044</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;关于 default {@link ToStringConfig}:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1045" href="#L1045">1045</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1046" href="#L1046">1046</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1047" href="#L1047">1047</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1048" href="#L1048">1048</a> <em class="jxr_javadoccomment">     * 如果参数 &lt;code&gt;toStringConfig&lt;/code&gt; 是null,则使用默认的规则:&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1049" href="#L1049">1049</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1050" href="#L1050">1050</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1051" href="#L1051">1051</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1052" href="#L1052">1052</a> <em class="jxr_javadoccomment">     * &lt;li&gt;连接符使用{@link ToStringConfig#DEFAULT_CONNECTOR}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1053" href="#L1053">1053</a> <em class="jxr_javadoccomment">     * &lt;li&gt;拼接null或者empty元素&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1054" href="#L1054">1054</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果元素是null,使用{@link StringUtils#EMPTY}替代拼接&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1055" href="#L1055">1055</a> <em class="jxr_javadoccomment">     * &lt;li&gt;最后一个元素后面不拼接拼接符&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1056" href="#L1056">1056</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1057" href="#L1057">1057</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1058" href="#L1058">1058</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1059" href="#L1059">1059</a> <em class="jxr_javadoccomment">     * @param collection</em>
<a class="jxr_linenumber" name="L1060" href="#L1060">1060</a> <em class="jxr_javadoccomment">     *            集合,建议元素泛型不要使用自定义的对象(比如UserCommand等),因为这个方法是迭代collection,拿每个元素的字符串格式 进行拼接</em>
<a class="jxr_linenumber" name="L1061" href="#L1061">1061</a> <em class="jxr_javadoccomment">     * @param toStringConfig</em>
<a class="jxr_linenumber" name="L1062" href="#L1062">1062</a> <em class="jxr_javadoccomment">     *            连接字符串 实体</em>
<a class="jxr_linenumber" name="L1063" href="#L1063">1063</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;collection&lt;/code&gt; 是null或者empty,返回 {@link StringUtils#EMPTY}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1064" href="#L1064">1064</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;toStringConfig&lt;/code&gt; 是null,使用默认 {@link ToStringConfig#DEFAULT_CONNECTOR}以及 joinNullOrEmpty 进行连接&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1065" href="#L1065">1065</a> <em class="jxr_javadoccomment">     *         都不是null,会循环,拼接toStringConfig.getConnector()</em>
<a class="jxr_linenumber" name="L1066" href="#L1066">1066</a> <em class="jxr_javadoccomment">     * @see "org.springframework.util.StringUtils#collectionToDelimitedString(Collection, String, String, String)"</em>
<a class="jxr_linenumber" name="L1067" href="#L1067">1067</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.IteratorUtils#toString(Iterator)</em>
<a class="jxr_linenumber" name="L1068" href="#L1068">1068</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.StringUtils#join(Iterable, String)</em>
<a class="jxr_linenumber" name="L1069" href="#L1069">1069</a> <em class="jxr_javadoccomment">     * @since 1.8.4 change param order</em>
<a class="jxr_linenumber" name="L1070" href="#L1070">1070</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1071" href="#L1071">1071</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String toString(<strong class="jxr_keyword">final</strong> Collection&lt;?&gt; collection,ToStringConfig toStringConfig){
<a class="jxr_linenumber" name="L1072" href="#L1072">1072</a>         <strong class="jxr_keyword">return</strong> isNullOrEmpty(collection) ? EMPTY : toString(collection.toArray(), toStringConfig);
<a class="jxr_linenumber" name="L1073" href="#L1073">1073</a>     }
<a class="jxr_linenumber" name="L1074" href="#L1074">1074</a> 
<a class="jxr_linenumber" name="L1075" href="#L1075">1075</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1076" href="#L1076">1076</a> <em class="jxr_javadoccomment">     * 将数组 &lt;code&gt;arrays&lt;/code&gt; 通过{@link ToStringConfig} 拼接成字符串.</em>
<a class="jxr_linenumber" name="L1077" href="#L1077">1077</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1078" href="#L1078">1078</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1079" href="#L1079">1079</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1080" href="#L1080">1080</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1081" href="#L1081">1081</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1082" href="#L1082">1082</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1083" href="#L1083">1083</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(toArray("a","b"),new ToStringConfig())       =   "a,b"</em>
<a class="jxr_linenumber" name="L1084" href="#L1084">1084</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1085" href="#L1085">1085</a> <em class="jxr_javadoccomment">     * ToStringConfig toStringConfig=new ToStringConfig(",");</em>
<a class="jxr_linenumber" name="L1086" href="#L1086">1086</a> <em class="jxr_javadoccomment">     * toStringConfig.setIsJoinNullOrEmpty(false);</em>
<a class="jxr_linenumber" name="L1087" href="#L1087">1087</a> <em class="jxr_javadoccomment">     * ConvertUtil.toString(toArray("a","b",null),new ToStringConfig())  =   "a,b"</em>
<a class="jxr_linenumber" name="L1088" href="#L1088">1088</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1089" href="#L1089">1089</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1090" href="#L1090">1090</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1091" href="#L1091">1091</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1092" href="#L1092">1092</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;如果原始类型数组需要转换:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1093" href="#L1093">1093</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1094" href="#L1094">1094</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1095" href="#L1095">1095</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1096" href="#L1096">1096</a> <em class="jxr_javadoccomment">     * 需要先使用下列的方式先转成包装类型数组</em>
<a class="jxr_linenumber" name="L1097" href="#L1097">1097</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1098" href="#L1098">1098</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1099" href="#L1099">1099</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1100" href="#L1100">1100</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(boolean[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1101" href="#L1101">1101</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(byte[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1102" href="#L1102">1102</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(char[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1103" href="#L1103">1103</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(double[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1104" href="#L1104">1104</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(float[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1105" href="#L1105">1105</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(int[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1106" href="#L1106">1106</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(long[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1107" href="#L1107">1107</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link ArrayUtils#toObject(short[])}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1108" href="#L1108">1108</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1109" href="#L1109">1109</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1110" href="#L1110">1110</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1111" href="#L1111">1111</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;关于 default {@link ToStringConfig}:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1112" href="#L1112">1112</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1113" href="#L1113">1113</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1114" href="#L1114">1114</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1115" href="#L1115">1115</a> <em class="jxr_javadoccomment">     * 如果参数 &lt;code&gt;toStringConfig&lt;/code&gt; 是null,则使用默认的规则:&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1116" href="#L1116">1116</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1117" href="#L1117">1117</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1118" href="#L1118">1118</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1119" href="#L1119">1119</a> <em class="jxr_javadoccomment">     * &lt;li&gt;连接符使用{@link ToStringConfig#DEFAULT_CONNECTOR}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1120" href="#L1120">1120</a> <em class="jxr_javadoccomment">     * &lt;li&gt;拼接null或者empty元素&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1121" href="#L1121">1121</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果元素是null,使用{@link StringUtils#EMPTY}替代拼接&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1122" href="#L1122">1122</a> <em class="jxr_javadoccomment">     * &lt;li&gt;最后一个元素后面不拼接拼接符&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1123" href="#L1123">1123</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1124" href="#L1124">1124</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1125" href="#L1125">1125</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L1126" href="#L1126">1126</a> <em class="jxr_javadoccomment">     * @param arrays</em>
<a class="jxr_linenumber" name="L1127" href="#L1127">1127</a> <em class="jxr_javadoccomment">     *            支持包装类型,&lt;b&gt;不直接支持&lt;/b&gt;原始类型</em>
<a class="jxr_linenumber" name="L1128" href="#L1128">1128</a> <em class="jxr_javadoccomment">     * @param toStringConfig</em>
<a class="jxr_linenumber" name="L1129" href="#L1129">1129</a> <em class="jxr_javadoccomment">     *            the to string config</em>
<a class="jxr_linenumber" name="L1130" href="#L1130">1130</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;arrays&lt;/code&gt; 是null 或者Empty,返回 {@link StringUtils#EMPTY}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1131" href="#L1131">1131</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;toStringConfig&lt;/code&gt; 是null,使用默认 {@link ToStringConfig#DEFAULT_CONNECTOR}以及 joinNullOrEmpty 进行连接&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1132" href="#L1132">1132</a> <em class="jxr_javadoccomment">     *         否则循环,拼接 {@link ToStringConfig#getConnector()}</em>
<a class="jxr_linenumber" name="L1133" href="#L1133">1133</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.builder.ToStringStyle</em>
<a class="jxr_linenumber" name="L1134" href="#L1134">1134</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.StringUtils#join(Object[], String)</em>
<a class="jxr_linenumber" name="L1135" href="#L1135">1135</a> <em class="jxr_javadoccomment">     * @since 1.8.4 change param order</em>
<a class="jxr_linenumber" name="L1136" href="#L1136">1136</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1137" href="#L1137">1137</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String toString(Object[] arrays,ToStringConfig toStringConfig){
<a class="jxr_linenumber" name="L1138" href="#L1138">1138</a>         <strong class="jxr_keyword">if</strong> (isNullOrEmpty(arrays)){
<a class="jxr_linenumber" name="L1139" href="#L1139">1139</a>             <strong class="jxr_keyword">return</strong> EMPTY;
<a class="jxr_linenumber" name="L1140" href="#L1140">1140</a>         }
<a class="jxr_linenumber" name="L1141" href="#L1141">1141</a>         <a href="../../../../com/feilong/core/bean/ToStringConfig.html">ToStringConfig</a> useToStringConfig = defaultIfNull(toStringConfig, <strong class="jxr_keyword">new</strong> <a href="../../../../com/feilong/core/bean/ToStringConfig.html">ToStringConfig</a>());
<a class="jxr_linenumber" name="L1142" href="#L1142">1142</a>         <strong class="jxr_keyword">return</strong> join(arrays, useToStringConfig.getConnector(), useToStringConfig.getIsJoinNullOrEmpty());
<a class="jxr_linenumber" name="L1143" href="#L1143">1143</a>     }
<a class="jxr_linenumber" name="L1144" href="#L1144">1144</a> 
<a class="jxr_linenumber" name="L1145" href="#L1145">1145</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1146" href="#L1146">1146</a> <em class="jxr_javadoccomment">     * Join.</em>
<a class="jxr_linenumber" name="L1147" href="#L1147">1147</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L1148" href="#L1148">1148</a> <em class="jxr_javadoccomment">     * @param operateArray</em>
<a class="jxr_linenumber" name="L1149" href="#L1149">1149</a> <em class="jxr_javadoccomment">     *            the operate array</em>
<a class="jxr_linenumber" name="L1150" href="#L1150">1150</a> <em class="jxr_javadoccomment">     * @param connector</em>
<a class="jxr_linenumber" name="L1151" href="#L1151">1151</a> <em class="jxr_javadoccomment">     *            the connector</em>
<a class="jxr_linenumber" name="L1152" href="#L1152">1152</a> <em class="jxr_javadoccomment">     * @param isJoinNullOrEmpty</em>
<a class="jxr_linenumber" name="L1153" href="#L1153">1153</a> <em class="jxr_javadoccomment">     *            the is join null或者empty</em>
<a class="jxr_linenumber" name="L1154" href="#L1154">1154</a> <em class="jxr_javadoccomment">     * @return the string</em>
<a class="jxr_linenumber" name="L1155" href="#L1155">1155</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.StringUtils#join(Iterable, String)</em>
<a class="jxr_linenumber" name="L1156" href="#L1156">1156</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.StringUtils#join(Object[], String)</em>
<a class="jxr_linenumber" name="L1157" href="#L1157">1157</a> <em class="jxr_javadoccomment">     * @since 1.6.3</em>
<a class="jxr_linenumber" name="L1158" href="#L1158">1158</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1159" href="#L1159">1159</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String join(Object[] operateArray,String connector,<strong class="jxr_keyword">boolean</strong> isJoinNullOrEmpty){
<a class="jxr_linenumber" name="L1160" href="#L1160">1160</a>         StringBuilder sb = <strong class="jxr_keyword">new</strong> StringBuilder();
<a class="jxr_linenumber" name="L1161" href="#L1161">1161</a>         <strong class="jxr_keyword">for</strong> (Object obj : operateArray){
<a class="jxr_linenumber" name="L1162" href="#L1162">1162</a>             <em class="jxr_comment">//如果是null或者empty,但是参数值是不拼接,那么跳过,继续循环</em>
<a class="jxr_linenumber" name="L1163" href="#L1163">1163</a>             <strong class="jxr_keyword">if</strong> (isNullOrEmpty(obj) &amp;&amp; !isJoinNullOrEmpty){
<a class="jxr_linenumber" name="L1164" href="#L1164">1164</a>                 <strong class="jxr_keyword">continue</strong>;
<a class="jxr_linenumber" name="L1165" href="#L1165">1165</a>             }
<a class="jxr_linenumber" name="L1166" href="#L1166">1166</a> 
<a class="jxr_linenumber" name="L1167" href="#L1167">1167</a>             <em class="jxr_comment">//value转换,注意:如果 value是null,StringBuilder将拼接 "null" 字符串,详见  java.lang.AbstractStringBuilder#append(String)</em>
<a class="jxr_linenumber" name="L1168" href="#L1168">1168</a>             sb.append(defaultIfNull(obj, EMPTY)); <em class="jxr_comment">//see StringUtils.defaultString(t)</em>
<a class="jxr_linenumber" name="L1169" href="#L1169">1169</a> 
<a class="jxr_linenumber" name="L1170" href="#L1170">1170</a>             <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> != connector){<em class="jxr_comment">//注意可能传过来的是换行符 不能使用Validator.isNullOrEmpty来判断</em>
<a class="jxr_linenumber" name="L1171" href="#L1171">1171</a>                 sb.append(connector);<em class="jxr_comment">//放心大胆的拼接 connector, 不判断是否是最后一个,最后会截取</em>
<a class="jxr_linenumber" name="L1172" href="#L1172">1172</a>             }
<a class="jxr_linenumber" name="L1173" href="#L1173">1173</a>         }
<a class="jxr_linenumber" name="L1174" href="#L1174">1174</a>         <strong class="jxr_keyword">return</strong> StringUtil.substringWithoutLast(sb, connector);
<a class="jxr_linenumber" name="L1175" href="#L1175">1175</a>     }
<a class="jxr_linenumber" name="L1176" href="#L1176">1176</a> 
<a class="jxr_linenumber" name="L1177" href="#L1177">1177</a>     <em class="jxr_comment">//**********************************************************************************************</em>
<a class="jxr_linenumber" name="L1178" href="#L1178">1178</a> 
<a class="jxr_linenumber" name="L1179" href="#L1179">1179</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1180" href="#L1180">1180</a> <em class="jxr_javadoccomment">     * 将集合 &lt;code&gt;collection&lt;/code&gt; 转成&lt;code&gt;Enumeration&lt;/code&gt;.</em>
<a class="jxr_linenumber" name="L1181" href="#L1181">1181</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1182" href="#L1182">1182</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1183" href="#L1183">1183</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1184" href="#L1184">1184</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1185" href="#L1185">1185</a> <em class="jxr_javadoccomment">     * &lt;li&gt;一般情况,你可能不需要这个方法,不过在一些API的时候,需要&lt;code&gt;Enumeration&lt;/code&gt;参数,此时调用这个方法来进行转换会比较方便&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1186" href="#L1186">1186</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1187" href="#L1187">1187</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1188" href="#L1188">1188</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1189" href="#L1189">1189</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1190" href="#L1190">1190</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1191" href="#L1191">1191</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1192" href="#L1192">1192</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1193" href="#L1193">1193</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1194" href="#L1194">1194</a> <em class="jxr_javadoccomment">     * ConvertUtil.toEnumeration(null) = Collections.emptyEnumeration()</em>
<a class="jxr_linenumber" name="L1195" href="#L1195">1195</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1196" href="#L1196">1196</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1197" href="#L1197">1197</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1198" href="#L1198">1198</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1199" href="#L1199">1199</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L1200" href="#L1200">1200</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L1201" href="#L1201">1201</a> <em class="jxr_javadoccomment">     * @param collection</em>
<a class="jxr_linenumber" name="L1202" href="#L1202">1202</a> <em class="jxr_javadoccomment">     *            集合</em>
<a class="jxr_linenumber" name="L1203" href="#L1203">1203</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;collection&lt;/code&gt; 是null,返回 {@link Collections#emptyEnumeration()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1204" href="#L1204">1204</a> <em class="jxr_javadoccomment">     *         否则返回{@link Collections#enumeration(Collection)}</em>
<a class="jxr_linenumber" name="L1205" href="#L1205">1205</a> <em class="jxr_javadoccomment">     * @see Collections#enumeration(Collection)</em>
<a class="jxr_linenumber" name="L1206" href="#L1206">1206</a> <em class="jxr_javadoccomment">     * @since 1.4.0</em>
<a class="jxr_linenumber" name="L1207" href="#L1207">1207</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1208" href="#L1208">1208</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; Enumeration&lt;T&gt; toEnumeration(<strong class="jxr_keyword">final</strong> Collection&lt;T&gt; collection){
<a class="jxr_linenumber" name="L1209" href="#L1209">1209</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong> == collection ? Collections.&lt;T&gt; emptyEnumeration() : Collections.enumeration(collection);
<a class="jxr_linenumber" name="L1210" href="#L1210">1210</a>     }
<a class="jxr_linenumber" name="L1211" href="#L1211">1211</a> 
<a class="jxr_linenumber" name="L1212" href="#L1212">1212</a>     <em class="jxr_comment">//**************************toMap******************************************************</em>
<a class="jxr_linenumber" name="L1213" href="#L1213">1213</a> 
<a class="jxr_linenumber" name="L1214" href="#L1214">1214</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1215" href="#L1215">1215</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;mapEntryCollection&lt;/code&gt; 转成map ({@link LinkedHashMap}).</em>
<a class="jxr_linenumber" name="L1216" href="#L1216">1216</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1217" href="#L1217">1217</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1218" href="#L1218">1218</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1219" href="#L1219">1219</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1220" href="#L1220">1220</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1221" href="#L1221">1221</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回是的是 {@link LinkedHashMap},顺序依照参数 &lt;code&gt;mapEntryCollection&lt;/code&gt;,key是 {@link java.util.Map.Entry#getKey()},value 是</em>
<a class="jxr_linenumber" name="L1222" href="#L1222">1222</a> <em class="jxr_javadoccomment">     * {@link java.util.Map.Entry#getValue()}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1223" href="#L1223">1223</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link java.util.Map.Entry} 已知实现类,你可以使用 {@link Pair},或者 {@link java.util.AbstractMap.SimpleEntry}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1224" href="#L1224">1224</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1225" href="#L1225">1225</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1226" href="#L1226">1226</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1227" href="#L1227">1227</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;{@link Pair} 示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1228" href="#L1228">1228</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1229" href="#L1229">1229</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1230" href="#L1230">1230</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1231" href="#L1231">1231</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1232" href="#L1232">1232</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = toMap(toList(//</em>
<a class="jxr_linenumber" name="L1233" href="#L1233">1233</a> <em class="jxr_javadoccomment">     *                 Pair.of("张飞", "丈八蛇矛"),</em>
<a class="jxr_linenumber" name="L1234" href="#L1234">1234</a> <em class="jxr_javadoccomment">     *                 Pair.of("关羽", "青龙偃月刀"),</em>
<a class="jxr_linenumber" name="L1235" href="#L1235">1235</a> <em class="jxr_javadoccomment">     *                 Pair.of("赵云", "龙胆枪"),</em>
<a class="jxr_linenumber" name="L1236" href="#L1236">1236</a> <em class="jxr_javadoccomment">     *                 Pair.of("刘备", "双股剑")));</em>
<a class="jxr_linenumber" name="L1237" href="#L1237">1237</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(map));</em>
<a class="jxr_linenumber" name="L1238" href="#L1238">1238</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1239" href="#L1239">1239</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1240" href="#L1240">1240</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1241" href="#L1241">1241</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1242" href="#L1242">1242</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1243" href="#L1243">1243</a> <em class="jxr_javadoccomment">     * {</em>
<a class="jxr_linenumber" name="L1244" href="#L1244">1244</a> <em class="jxr_javadoccomment">     * "张飞": "丈八蛇矛",</em>
<a class="jxr_linenumber" name="L1245" href="#L1245">1245</a> <em class="jxr_javadoccomment">     * "关羽": "青龙偃月刀",</em>
<a class="jxr_linenumber" name="L1246" href="#L1246">1246</a> <em class="jxr_javadoccomment">     * "赵云": "龙胆枪",</em>
<a class="jxr_linenumber" name="L1247" href="#L1247">1247</a> <em class="jxr_javadoccomment">     * "刘备": "双股剑"</em>
<a class="jxr_linenumber" name="L1248" href="#L1248">1248</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1249" href="#L1249">1249</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1250" href="#L1250">1250</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1251" href="#L1251">1251</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1252" href="#L1252">1252</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1253" href="#L1253">1253</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;{@link java.util.AbstractMap.SimpleEntry} 示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1254" href="#L1254">1254</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1255" href="#L1255">1255</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1256" href="#L1256">1256</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1257" href="#L1257">1257</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1258" href="#L1258">1258</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = ConvertUtil.toMap(</em>
<a class="jxr_linenumber" name="L1259" href="#L1259">1259</a> <em class="jxr_javadoccomment">     *                 toList(</em>
<a class="jxr_linenumber" name="L1260" href="#L1260">1260</a> <em class="jxr_javadoccomment">     *                                 new SimpleEntry{@code &lt;&gt;}("张飞", "丈八蛇矛"),</em>
<a class="jxr_linenumber" name="L1261" href="#L1261">1261</a> <em class="jxr_javadoccomment">     *                                 new SimpleEntry{@code &lt;&gt;}("关羽", "青龙偃月刀"),</em>
<a class="jxr_linenumber" name="L1262" href="#L1262">1262</a> <em class="jxr_javadoccomment">     *                                 new SimpleEntry{@code &lt;&gt;}("赵云", "龙胆枪"),</em>
<a class="jxr_linenumber" name="L1263" href="#L1263">1263</a> <em class="jxr_javadoccomment">     *                                 new SimpleEntry{@code &lt;&gt;}("刘备", "双股剑")));</em>
<a class="jxr_linenumber" name="L1264" href="#L1264">1264</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(map));</em>
<a class="jxr_linenumber" name="L1265" href="#L1265">1265</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1266" href="#L1266">1266</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1267" href="#L1267">1267</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1268" href="#L1268">1268</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1269" href="#L1269">1269</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1270" href="#L1270">1270</a> <em class="jxr_javadoccomment">     * {</em>
<a class="jxr_linenumber" name="L1271" href="#L1271">1271</a> <em class="jxr_javadoccomment">     * "张飞": "丈八蛇矛",</em>
<a class="jxr_linenumber" name="L1272" href="#L1272">1272</a> <em class="jxr_javadoccomment">     * "关羽": "青龙偃月刀",</em>
<a class="jxr_linenumber" name="L1273" href="#L1273">1273</a> <em class="jxr_javadoccomment">     * "赵云": "龙胆枪",</em>
<a class="jxr_linenumber" name="L1274" href="#L1274">1274</a> <em class="jxr_javadoccomment">     * "刘备": "双股剑"</em>
<a class="jxr_linenumber" name="L1275" href="#L1275">1275</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1276" href="#L1276">1276</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1277" href="#L1277">1277</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1278" href="#L1278">1278</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1279" href="#L1279">1279</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L1280" href="#L1280">1280</a> <em class="jxr_javadoccomment">     * @param &lt;V&gt;</em>
<a class="jxr_linenumber" name="L1281" href="#L1281">1281</a> <em class="jxr_javadoccomment">     *            the value type</em>
<a class="jxr_linenumber" name="L1282" href="#L1282">1282</a> <em class="jxr_javadoccomment">     * @param &lt;K&gt;</em>
<a class="jxr_linenumber" name="L1283" href="#L1283">1283</a> <em class="jxr_javadoccomment">     *            the key type</em>
<a class="jxr_linenumber" name="L1284" href="#L1284">1284</a> <em class="jxr_javadoccomment">     * @param &lt;E&gt;</em>
<a class="jxr_linenumber" name="L1285" href="#L1285">1285</a> <em class="jxr_javadoccomment">     *            the element type</em>
<a class="jxr_linenumber" name="L1286" href="#L1286">1286</a> <em class="jxr_javadoccomment">     * @param mapEntryCollection</em>
<a class="jxr_linenumber" name="L1287" href="#L1287">1287</a> <em class="jxr_javadoccomment">     *            the map entry collection</em>
<a class="jxr_linenumber" name="L1288" href="#L1288">1288</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;mapEntryCollection&lt;/code&gt; 是null,返回 {@link Collections#emptyMap()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1289" href="#L1289">1289</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;mapEntryCollection&lt;/code&gt; 有元素是null,将会抛出异常 {@link IllegalArgumentException}</em>
<a class="jxr_linenumber" name="L1290" href="#L1290">1290</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.ArrayUtils#toMap(Object[])</em>
<a class="jxr_linenumber" name="L1291" href="#L1291">1291</a> <em class="jxr_javadoccomment">     * @since 1.7.1</em>
<a class="jxr_linenumber" name="L1292" href="#L1292">1292</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1293" href="#L1293">1293</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;V, K, E <strong class="jxr_keyword">extends</strong> Map.Entry&lt;K, V&gt;&gt; Map&lt;K, V&gt; toMap(Collection&lt;E&gt; mapEntryCollection){
<a class="jxr_linenumber" name="L1294" href="#L1294">1294</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == mapEntryCollection){
<a class="jxr_linenumber" name="L1295" href="#L1295">1295</a>             <strong class="jxr_keyword">return</strong> emptyMap();
<a class="jxr_linenumber" name="L1296" href="#L1296">1296</a>         }
<a class="jxr_linenumber" name="L1297" href="#L1297">1297</a> 
<a class="jxr_linenumber" name="L1298" href="#L1298">1298</a>         Validate.noNullElements(mapEntryCollection, <span class="jxr_string">"mapEntryCollection can't has null elememt!"</span>);
<a class="jxr_linenumber" name="L1299" href="#L1299">1299</a> 
<a class="jxr_linenumber" name="L1300" href="#L1300">1300</a>         Map&lt;K, V&gt; map = newLinkedHashMap(mapEntryCollection.size());
<a class="jxr_linenumber" name="L1301" href="#L1301">1301</a>         <strong class="jxr_keyword">for</strong> (Map.Entry&lt;K, V&gt; entry : mapEntryCollection){
<a class="jxr_linenumber" name="L1302" href="#L1302">1302</a>             map.put(entry.getKey(), entry.getValue());
<a class="jxr_linenumber" name="L1303" href="#L1303">1303</a>         }
<a class="jxr_linenumber" name="L1304" href="#L1304">1304</a>         <strong class="jxr_keyword">return</strong> map;
<a class="jxr_linenumber" name="L1305" href="#L1305">1305</a>     }
<a class="jxr_linenumber" name="L1306" href="#L1306">1306</a> 
<a class="jxr_linenumber" name="L1307" href="#L1307">1307</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1308" href="#L1308">1308</a> <em class="jxr_javadoccomment">     * 将 {@link java.util.Map.Entry}数组转成map ({@link LinkedHashMap}).</em>
<a class="jxr_linenumber" name="L1309" href="#L1309">1309</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1310" href="#L1310">1310</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1311" href="#L1311">1311</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1312" href="#L1312">1312</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1313" href="#L1313">1313</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1314" href="#L1314">1314</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回是的是 {@link LinkedHashMap},顺序依照参数 {@link java.util.Map.Entry}数组顺序,key是 {@link java.util.Map.Entry#getKey()},value 是</em>
<a class="jxr_linenumber" name="L1315" href="#L1315">1315</a> <em class="jxr_javadoccomment">     * {@link java.util.Map.Entry#getValue()}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1316" href="#L1316">1316</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link java.util.Map.Entry} 已知实现类,你可以使用 {@link Pair},或者 {@link java.util.AbstractMap.SimpleEntry}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1317" href="#L1317">1317</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1318" href="#L1318">1318</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1319" href="#L1319">1319</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1320" href="#L1320">1320</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;{@link Pair} 示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1321" href="#L1321">1321</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1322" href="#L1322">1322</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1323" href="#L1323">1323</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1324" href="#L1324">1324</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1325" href="#L1325">1325</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = ConvertUtil.toMapUseEntrys(</em>
<a class="jxr_linenumber" name="L1326" href="#L1326">1326</a> <em class="jxr_javadoccomment">     *                 Pair.of("张飞", "丈八蛇矛"),</em>
<a class="jxr_linenumber" name="L1327" href="#L1327">1327</a> <em class="jxr_javadoccomment">     *                 Pair.of("关羽", "青龙偃月刀"),</em>
<a class="jxr_linenumber" name="L1328" href="#L1328">1328</a> <em class="jxr_javadoccomment">     *                 Pair.of("赵云", "龙胆枪"),</em>
<a class="jxr_linenumber" name="L1329" href="#L1329">1329</a> <em class="jxr_javadoccomment">     *                 Pair.of("刘备", "双股剑"));</em>
<a class="jxr_linenumber" name="L1330" href="#L1330">1330</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(map));</em>
<a class="jxr_linenumber" name="L1331" href="#L1331">1331</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1332" href="#L1332">1332</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1333" href="#L1333">1333</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1334" href="#L1334">1334</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1335" href="#L1335">1335</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1336" href="#L1336">1336</a> <em class="jxr_javadoccomment">     * {</em>
<a class="jxr_linenumber" name="L1337" href="#L1337">1337</a> <em class="jxr_javadoccomment">     * "张飞": "丈八蛇矛",</em>
<a class="jxr_linenumber" name="L1338" href="#L1338">1338</a> <em class="jxr_javadoccomment">     * "关羽": "青龙偃月刀",</em>
<a class="jxr_linenumber" name="L1339" href="#L1339">1339</a> <em class="jxr_javadoccomment">     * "赵云": "龙胆枪",</em>
<a class="jxr_linenumber" name="L1340" href="#L1340">1340</a> <em class="jxr_javadoccomment">     * "刘备": "双股剑"</em>
<a class="jxr_linenumber" name="L1341" href="#L1341">1341</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1342" href="#L1342">1342</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1343" href="#L1343">1343</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1344" href="#L1344">1344</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1345" href="#L1345">1345</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1346" href="#L1346">1346</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1347" href="#L1347">1347</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;{@link java.util.AbstractMap.SimpleEntry} 示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1348" href="#L1348">1348</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1349" href="#L1349">1349</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1350" href="#L1350">1350</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1351" href="#L1351">1351</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1352" href="#L1352">1352</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1353" href="#L1353">1353</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = ConvertUtil.toMapUseEntrys(</em>
<a class="jxr_linenumber" name="L1354" href="#L1354">1354</a> <em class="jxr_javadoccomment">     *                 new SimpleEntry{@code &lt;&gt;}("张飞", "丈八蛇矛"),</em>
<a class="jxr_linenumber" name="L1355" href="#L1355">1355</a> <em class="jxr_javadoccomment">     *                 new SimpleEntry{@code &lt;&gt;}("关羽", "青龙偃月刀"),</em>
<a class="jxr_linenumber" name="L1356" href="#L1356">1356</a> <em class="jxr_javadoccomment">     *                 new SimpleEntry{@code &lt;&gt;}("赵云", "龙胆枪"),</em>
<a class="jxr_linenumber" name="L1357" href="#L1357">1357</a> <em class="jxr_javadoccomment">     *                 new SimpleEntry{@code &lt;&gt;}("刘备", "双股剑"));</em>
<a class="jxr_linenumber" name="L1358" href="#L1358">1358</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(map));</em>
<a class="jxr_linenumber" name="L1359" href="#L1359">1359</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1360" href="#L1360">1360</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1361" href="#L1361">1361</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1362" href="#L1362">1362</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1363" href="#L1363">1363</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1364" href="#L1364">1364</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1365" href="#L1365">1365</a> <em class="jxr_javadoccomment">     * {</em>
<a class="jxr_linenumber" name="L1366" href="#L1366">1366</a> <em class="jxr_javadoccomment">     * "张飞": "丈八蛇矛",</em>
<a class="jxr_linenumber" name="L1367" href="#L1367">1367</a> <em class="jxr_javadoccomment">     * "关羽": "青龙偃月刀",</em>
<a class="jxr_linenumber" name="L1368" href="#L1368">1368</a> <em class="jxr_javadoccomment">     * "赵云": "龙胆枪",</em>
<a class="jxr_linenumber" name="L1369" href="#L1369">1369</a> <em class="jxr_javadoccomment">     * "刘备": "双股剑"</em>
<a class="jxr_linenumber" name="L1370" href="#L1370">1370</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1371" href="#L1371">1371</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1372" href="#L1372">1372</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1373" href="#L1373">1373</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1374" href="#L1374">1374</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1375" href="#L1375">1375</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1376" href="#L1376">1376</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1377" href="#L1377">1377</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;重构:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1378" href="#L1378">1378</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1379" href="#L1379">1379</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1380" href="#L1380">1380</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1381" href="#L1381">1381</a> <em class="jxr_javadoccomment">     * 以前初始化全局map的时候,你可能会这么写</em>
<a class="jxr_linenumber" name="L1382" href="#L1382">1382</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1383" href="#L1383">1383</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1384" href="#L1384">1384</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1385" href="#L1385">1385</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1386" href="#L1386">1386</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// 除数和单位的map,必须是有顺序的 从大到小.&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1387" href="#L1387">1387</a> <em class="jxr_javadoccomment">     * private static final Map{@code &lt;Long, String&gt;} DIVISOR_AND_UNIT_MAP = new LinkedHashMap{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L1388" href="#L1388">1388</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1389" href="#L1389">1389</a> <em class="jxr_javadoccomment">     * static{</em>
<a class="jxr_linenumber" name="L1390" href="#L1390">1390</a> <em class="jxr_javadoccomment">     *     DIVISOR_AND_UNIT_MAP.put(FileUtils.ONE_TB, "TB");&lt;span style="color:green"&gt;//(Terabyte,太字节,或百万兆字节)=1024GB,其中1024=2^10(2的10次方)&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1391" href="#L1391">1391</a> <em class="jxr_javadoccomment">     *     DIVISOR_AND_UNIT_MAP.put(FileUtils.ONE_GB, "GB");&lt;span style="color:green"&gt;//(Gigabyte,吉字节,又称“千兆”)=1024MB&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1392" href="#L1392">1392</a> <em class="jxr_javadoccomment">     *     DIVISOR_AND_UNIT_MAP.put(FileUtils.ONE_MB, "MB");&lt;span style="color:green"&gt;//(Megabyte,兆字节,简称“兆”)=1024KB&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1393" href="#L1393">1393</a> <em class="jxr_javadoccomment">     *     DIVISOR_AND_UNIT_MAP.put(FileUtils.ONE_KB, "KB");&lt;span style="color:green"&gt;//(Kilobyte 千字节)=1024B&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1394" href="#L1394">1394</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1395" href="#L1395">1395</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1396" href="#L1396">1396</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1397" href="#L1397">1397</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1398" href="#L1398">1398</a> <em class="jxr_javadoccomment">     * &lt;b&gt;现在你可以重构成:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1399" href="#L1399">1399</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1400" href="#L1400">1400</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1401" href="#L1401">1401</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1402" href="#L1402">1402</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// 除数和单位的map,必须是有顺序的 从大到小.&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1403" href="#L1403">1403</a> <em class="jxr_javadoccomment">     * private static final Map{@code &lt;Long, String&gt;} DIVISOR_AND_UNIT_MAP = ConvertUtil.toMapUseEntrys(</em>
<a class="jxr_linenumber" name="L1404" href="#L1404">1404</a> <em class="jxr_javadoccomment">     *                 Pair.of(FileUtils.ONE_TB, "TB"), &lt;span style="color:green"&gt;//(Terabyte,太字节,或百万兆字节)=1024GB,其中1024=2^10(2的10次方) &lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1405" href="#L1405">1405</a> <em class="jxr_javadoccomment">     *                 Pair.of(FileUtils.ONE_GB, "GB"), &lt;span style="color:green"&gt;//(Gigabyte,吉字节,又称“千兆”)=1024MB&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1406" href="#L1406">1406</a> <em class="jxr_javadoccomment">     *                 Pair.of(FileUtils.ONE_MB, "MB"), &lt;span style="color:green"&gt;//(Megabyte,兆字节,简称“兆”)=1024KB&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1407" href="#L1407">1407</a> <em class="jxr_javadoccomment">     *                 Pair.of(FileUtils.ONE_KB, "KB")); &lt;span style="color:green"&gt;//(Kilobyte 千字节)=1024B&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1408" href="#L1408">1408</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1409" href="#L1409">1409</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1410" href="#L1410">1410</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1411" href="#L1411">1411</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1412" href="#L1412">1412</a> <em class="jxr_javadoccomment">     * 代码更加简洁</em>
<a class="jxr_linenumber" name="L1413" href="#L1413">1413</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1414" href="#L1414">1414</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1415" href="#L1415">1415</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1416" href="#L1416">1416</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L1417" href="#L1417">1417</a> <em class="jxr_javadoccomment">     * @param &lt;V&gt;</em>
<a class="jxr_linenumber" name="L1418" href="#L1418">1418</a> <em class="jxr_javadoccomment">     *            the value type</em>
<a class="jxr_linenumber" name="L1419" href="#L1419">1419</a> <em class="jxr_javadoccomment">     * @param &lt;K&gt;</em>
<a class="jxr_linenumber" name="L1420" href="#L1420">1420</a> <em class="jxr_javadoccomment">     *            the key type</em>
<a class="jxr_linenumber" name="L1421" href="#L1421">1421</a> <em class="jxr_javadoccomment">     * @param mapEntrys</em>
<a class="jxr_linenumber" name="L1422" href="#L1422">1422</a> <em class="jxr_javadoccomment">     *            the entrys</em>
<a class="jxr_linenumber" name="L1423" href="#L1423">1423</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;entrys&lt;/code&gt; 是null,返回 {@link Collections#emptyMap()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1424" href="#L1424">1424</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;entrys&lt;/code&gt; 有元素是null,将会抛出异常 {@link IllegalArgumentException}</em>
<a class="jxr_linenumber" name="L1425" href="#L1425">1425</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.tuple.ImmutablePair#ImmutablePair(Object, Object)</em>
<a class="jxr_linenumber" name="L1426" href="#L1426">1426</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.tuple.Pair#of(Object, Object)</em>
<a class="jxr_linenumber" name="L1427" href="#L1427">1427</a> <em class="jxr_javadoccomment">     * @since 1.7.1</em>
<a class="jxr_linenumber" name="L1428" href="#L1428">1428</a> <em class="jxr_javadoccomment">     * @since 1.9.5 change name</em>
<a class="jxr_linenumber" name="L1429" href="#L1429">1429</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1430" href="#L1430">1430</a>     @SafeVarargs
<a class="jxr_linenumber" name="L1431" href="#L1431">1431</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;V, K&gt; Map&lt;K, V&gt; toMapUseEntrys(Map.Entry&lt;K, V&gt;...mapEntrys){
<a class="jxr_linenumber" name="L1432" href="#L1432">1432</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == mapEntrys){
<a class="jxr_linenumber" name="L1433" href="#L1433">1433</a>             <strong class="jxr_keyword">return</strong> emptyMap();
<a class="jxr_linenumber" name="L1434" href="#L1434">1434</a>         }
<a class="jxr_linenumber" name="L1435" href="#L1435">1435</a>         Validate.noNullElements(mapEntrys, <span class="jxr_string">"mapEntrys can't has null elememt!"</span>);
<a class="jxr_linenumber" name="L1436" href="#L1436">1436</a> 
<a class="jxr_linenumber" name="L1437" href="#L1437">1437</a>         Map&lt;K, V&gt; map = newLinkedHashMap(mapEntrys.length);
<a class="jxr_linenumber" name="L1438" href="#L1438">1438</a>         <strong class="jxr_keyword">for</strong> (Map.Entry&lt;K, V&gt; entry : mapEntrys){
<a class="jxr_linenumber" name="L1439" href="#L1439">1439</a>             map.put(entry.getKey(), entry.getValue());
<a class="jxr_linenumber" name="L1440" href="#L1440">1440</a>         }
<a class="jxr_linenumber" name="L1441" href="#L1441">1441</a>         <strong class="jxr_keyword">return</strong> map;
<a class="jxr_linenumber" name="L1442" href="#L1442">1442</a>     }
<a class="jxr_linenumber" name="L1443" href="#L1443">1443</a> 
<a class="jxr_linenumber" name="L1444" href="#L1444">1444</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1445" href="#L1445">1445</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;key&lt;/code&gt; 和 &lt;code&gt;value&lt;/code&gt; 直接转成map.</em>
<a class="jxr_linenumber" name="L1446" href="#L1446">1446</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1447" href="#L1447">1447</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1448" href="#L1448">1448</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1449" href="#L1449">1449</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1450" href="#L1450">1450</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回是的是 {@link LinkedHashMap}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1451" href="#L1451">1451</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1452" href="#L1452">1452</a> <em class="jxr_javadoccomment">     * &lt;li&gt;</em>
<a class="jxr_linenumber" name="L1453" href="#L1453">1453</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1454" href="#L1454">1454</a> <em class="jxr_javadoccomment">     * 非常适合单key的场景,比如</em>
<a class="jxr_linenumber" name="L1455" href="#L1455">1455</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1456" href="#L1456">1456</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1457" href="#L1457">1457</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1458" href="#L1458">1458</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} paramMap = new HashMap{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L1459" href="#L1459">1459</a> <em class="jxr_javadoccomment">     * paramMap.put("name", "jinxin");</em>
<a class="jxr_linenumber" name="L1460" href="#L1460">1460</a> <em class="jxr_javadoccomment">     * request.setParamMap(paramMap);</em>
<a class="jxr_linenumber" name="L1461" href="#L1461">1461</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1462" href="#L1462">1462</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1463" href="#L1463">1463</a> <em class="jxr_javadoccomment">     * 上面的3行代码可以重写成</em>
<a class="jxr_linenumber" name="L1464" href="#L1464">1464</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1465" href="#L1465">1465</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1466" href="#L1466">1466</a> <em class="jxr_javadoccomment">     * request.setParamMap(toMap("name", "jinxin"));</em>
<a class="jxr_linenumber" name="L1467" href="#L1467">1467</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1468" href="#L1468">1468</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1469" href="#L1469">1469</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1470" href="#L1470">1470</a> <em class="jxr_javadoccomment">     * 一行代码就搞定了,很简洁,有木有~~</em>
<a class="jxr_linenumber" name="L1471" href="#L1471">1471</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1472" href="#L1472">1472</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1473" href="#L1473">1473</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1474" href="#L1474">1474</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1475" href="#L1475">1475</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1476" href="#L1476">1476</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1477" href="#L1477">1477</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1478" href="#L1478">1478</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1479" href="#L1479">1479</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1480" href="#L1480">1480</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1481" href="#L1481">1481</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1482" href="#L1482">1482</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(ConvertUtil.toMap("张飞", "丈八蛇矛")));</em>
<a class="jxr_linenumber" name="L1483" href="#L1483">1483</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1484" href="#L1484">1484</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1485" href="#L1485">1485</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1486" href="#L1486">1486</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1487" href="#L1487">1487</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1488" href="#L1488">1488</a> <em class="jxr_javadoccomment">     * {"张飞": "丈八蛇矛"}</em>
<a class="jxr_linenumber" name="L1489" href="#L1489">1489</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1490" href="#L1490">1490</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1491" href="#L1491">1491</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1492" href="#L1492">1492</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1493" href="#L1493">1493</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1494" href="#L1494">1494</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;重构:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1495" href="#L1495">1495</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1496" href="#L1496">1496</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1497" href="#L1497">1497</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1498" href="#L1498">1498</a> <em class="jxr_javadoccomment">     * 对于以下代码:</em>
<a class="jxr_linenumber" name="L1499" href="#L1499">1499</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1500" href="#L1500">1500</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1501" href="#L1501">1501</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1502" href="#L1502">1502</a> <em class="jxr_javadoccomment">     * private List{@code &lt;ShopCommand&gt;} loadShopCommandList(){</em>
<a class="jxr_linenumber" name="L1503" href="#L1503">1503</a> <em class="jxr_javadoccomment">     *     Map{@code &lt;String, Object&gt;} paraMap = new HashMap{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L1504" href="#L1504">1504</a> <em class="jxr_javadoccomment">     *     paraMap.put("orgTypeId", OrgType.ID_SHOP_TYPE);</em>
<a class="jxr_linenumber" name="L1505" href="#L1505">1505</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1506" href="#L1506">1506</a> <em class="jxr_javadoccomment">     *     return shopCommandDao.findShopListByOrgaTypeId(paraMap);</em>
<a class="jxr_linenumber" name="L1507" href="#L1507">1507</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1508" href="#L1508">1508</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1509" href="#L1509">1509</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1510" href="#L1510">1510</a> <em class="jxr_javadoccomment">     * &lt;b&gt;可以重构成:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1511" href="#L1511">1511</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1512" href="#L1512">1512</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1513" href="#L1513">1513</a> <em class="jxr_javadoccomment">     * private List{@code &lt;ShopCommand&gt;} loadShopCommandList(){</em>
<a class="jxr_linenumber" name="L1514" href="#L1514">1514</a> <em class="jxr_javadoccomment">     *     return shopCommandDao.findShopListByOrgaTypeId(ConvertUtil.toMap("orgTypeId", (Object) OrgType.ID_SHOP_TYPE));</em>
<a class="jxr_linenumber" name="L1515" href="#L1515">1515</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1516" href="#L1516">1516</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1517" href="#L1517">1517</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1518" href="#L1518">1518</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1519" href="#L1519">1519</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1520" href="#L1520">1520</a> <em class="jxr_javadoccomment">     * @param &lt;K&gt;</em>
<a class="jxr_linenumber" name="L1521" href="#L1521">1521</a> <em class="jxr_javadoccomment">     *            the key type</em>
<a class="jxr_linenumber" name="L1522" href="#L1522">1522</a> <em class="jxr_javadoccomment">     * @param &lt;V&gt;</em>
<a class="jxr_linenumber" name="L1523" href="#L1523">1523</a> <em class="jxr_javadoccomment">     *            the value type</em>
<a class="jxr_linenumber" name="L1524" href="#L1524">1524</a> <em class="jxr_javadoccomment">     * @param key</em>
<a class="jxr_linenumber" name="L1525" href="#L1525">1525</a> <em class="jxr_javadoccomment">     *            the key</em>
<a class="jxr_linenumber" name="L1526" href="#L1526">1526</a> <em class="jxr_javadoccomment">     * @param value</em>
<a class="jxr_linenumber" name="L1527" href="#L1527">1527</a> <em class="jxr_javadoccomment">     *            the value</em>
<a class="jxr_linenumber" name="L1528" href="#L1528">1528</a> <em class="jxr_javadoccomment">     * @return 将 &lt;code&gt;key&lt;/code&gt; 和 &lt;code&gt;value&lt;/code&gt; 直接转成map</em>
<a class="jxr_linenumber" name="L1529" href="#L1529">1529</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.ArrayUtils#toMap(Object[])</em>
<a class="jxr_linenumber" name="L1530" href="#L1530">1530</a> <em class="jxr_javadoccomment">     * @see java.util.Collections#singletonMap(Object, Object)</em>
<a class="jxr_linenumber" name="L1531" href="#L1531">1531</a> <em class="jxr_javadoccomment">     * @see "com.google.common.collect.ImmutableMap#of(K, V)"</em>
<a class="jxr_linenumber" name="L1532" href="#L1532">1532</a> <em class="jxr_javadoccomment">     * @since 1.7.1</em>
<a class="jxr_linenumber" name="L1533" href="#L1533">1533</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1534" href="#L1534">1534</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;K, V&gt; Map&lt;K, V&gt; toMap(K key,V value){
<a class="jxr_linenumber" name="L1535" href="#L1535">1535</a>         Map&lt;K, V&gt; map = <strong class="jxr_keyword">new</strong> LinkedHashMap&lt;&gt;();<em class="jxr_comment">//不设置初始值 ,可能调用再PUT 这样浪费性能</em>
<a class="jxr_linenumber" name="L1536" href="#L1536">1536</a>         map.put(key, value);
<a class="jxr_linenumber" name="L1537" href="#L1537">1537</a>         <strong class="jxr_keyword">return</strong> map;
<a class="jxr_linenumber" name="L1538" href="#L1538">1538</a>     }
<a class="jxr_linenumber" name="L1539" href="#L1539">1539</a> 
<a class="jxr_linenumber" name="L1540" href="#L1540">1540</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1541" href="#L1541">1541</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;key1&lt;/code&gt; 和 &lt;code&gt;value1&lt;/code&gt;/&lt;code&gt;key2&lt;/code&gt; 和 &lt;code&gt;value2&lt;/code&gt; 直接转成map.</em>
<a class="jxr_linenumber" name="L1542" href="#L1542">1542</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1543" href="#L1543">1543</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1544" href="#L1544">1544</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1545" href="#L1545">1545</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1546" href="#L1546">1546</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回是的是 {@link LinkedHashMap}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1547" href="#L1547">1547</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1548" href="#L1548">1548</a> <em class="jxr_javadoccomment">     * &lt;li&gt;</em>
<a class="jxr_linenumber" name="L1549" href="#L1549">1549</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1550" href="#L1550">1550</a> <em class="jxr_javadoccomment">     * 非常适合2个key的场景,比如</em>
<a class="jxr_linenumber" name="L1551" href="#L1551">1551</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1552" href="#L1552">1552</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1553" href="#L1553">1553</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1554" href="#L1554">1554</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} paramMap = new HashMap{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L1555" href="#L1555">1555</a> <em class="jxr_javadoccomment">     * paramMap.put("name", "jinxin");</em>
<a class="jxr_linenumber" name="L1556" href="#L1556">1556</a> <em class="jxr_javadoccomment">     * paramMap.put("age", "18");</em>
<a class="jxr_linenumber" name="L1557" href="#L1557">1557</a> <em class="jxr_javadoccomment">     * request.setParamMap(paramMap);</em>
<a class="jxr_linenumber" name="L1558" href="#L1558">1558</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1559" href="#L1559">1559</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1560" href="#L1560">1560</a> <em class="jxr_javadoccomment">     * 上面的3行代码可以重写成</em>
<a class="jxr_linenumber" name="L1561" href="#L1561">1561</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1562" href="#L1562">1562</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1563" href="#L1563">1563</a> <em class="jxr_javadoccomment">     * request.setParamMap(toMap("name", "jinxin", "age", "18"));</em>
<a class="jxr_linenumber" name="L1564" href="#L1564">1564</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1565" href="#L1565">1565</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1566" href="#L1566">1566</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1567" href="#L1567">1567</a> <em class="jxr_javadoccomment">     * 一行代码就搞定了,很简洁,有木有~~</em>
<a class="jxr_linenumber" name="L1568" href="#L1568">1568</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1569" href="#L1569">1569</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1570" href="#L1570">1570</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1571" href="#L1571">1571</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1572" href="#L1572">1572</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1573" href="#L1573">1573</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1574" href="#L1574">1574</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;重构:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1575" href="#L1575">1575</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1576" href="#L1576">1576</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1577" href="#L1577">1577</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1578" href="#L1578">1578</a> <em class="jxr_javadoccomment">     * 对于以下代码:</em>
<a class="jxr_linenumber" name="L1579" href="#L1579">1579</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1580" href="#L1580">1580</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1581" href="#L1581">1581</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1582" href="#L1582">1582</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, Long&gt;} map = new HashMap{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L1583" href="#L1583">1583</a> <em class="jxr_javadoccomment">     * map.put("itemId", itemId);</em>
<a class="jxr_linenumber" name="L1584" href="#L1584">1584</a> <em class="jxr_javadoccomment">     * map.put("memberId", memberId);</em>
<a class="jxr_linenumber" name="L1585" href="#L1585">1585</a> <em class="jxr_javadoccomment">     * memberFavoritesDao.findMemberFavoritesByMemberIdAndItemId(map);</em>
<a class="jxr_linenumber" name="L1586" href="#L1586">1586</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1587" href="#L1587">1587</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1588" href="#L1588">1588</a> <em class="jxr_javadoccomment">     * &lt;b&gt;可以重构成:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1589" href="#L1589">1589</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1590" href="#L1590">1590</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1591" href="#L1591">1591</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, Long&gt;} map = ConvertUtil.toMap("itemId", itemId, "memberId", memberId);</em>
<a class="jxr_linenumber" name="L1592" href="#L1592">1592</a> <em class="jxr_javadoccomment">     * memberFavoritesDao.findMemberFavoritesByMemberIdAndItemId(map);</em>
<a class="jxr_linenumber" name="L1593" href="#L1593">1593</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1594" href="#L1594">1594</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1595" href="#L1595">1595</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1596" href="#L1596">1596</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L1597" href="#L1597">1597</a> <em class="jxr_javadoccomment">     * @param &lt;K&gt;</em>
<a class="jxr_linenumber" name="L1598" href="#L1598">1598</a> <em class="jxr_javadoccomment">     *            the key type</em>
<a class="jxr_linenumber" name="L1599" href="#L1599">1599</a> <em class="jxr_javadoccomment">     * @param &lt;V&gt;</em>
<a class="jxr_linenumber" name="L1600" href="#L1600">1600</a> <em class="jxr_javadoccomment">     *            the value type</em>
<a class="jxr_linenumber" name="L1601" href="#L1601">1601</a> <em class="jxr_javadoccomment">     * @param key1</em>
<a class="jxr_linenumber" name="L1602" href="#L1602">1602</a> <em class="jxr_javadoccomment">     *            the key 1</em>
<a class="jxr_linenumber" name="L1603" href="#L1603">1603</a> <em class="jxr_javadoccomment">     * @param value1</em>
<a class="jxr_linenumber" name="L1604" href="#L1604">1604</a> <em class="jxr_javadoccomment">     *            the value 1</em>
<a class="jxr_linenumber" name="L1605" href="#L1605">1605</a> <em class="jxr_javadoccomment">     * @param key2</em>
<a class="jxr_linenumber" name="L1606" href="#L1606">1606</a> <em class="jxr_javadoccomment">     *            the key 2</em>
<a class="jxr_linenumber" name="L1607" href="#L1607">1607</a> <em class="jxr_javadoccomment">     * @param value2</em>
<a class="jxr_linenumber" name="L1608" href="#L1608">1608</a> <em class="jxr_javadoccomment">     *            the value 2</em>
<a class="jxr_linenumber" name="L1609" href="#L1609">1609</a> <em class="jxr_javadoccomment">     * @return 将 &lt;code&gt;key1&lt;/code&gt; 和 &lt;code&gt;value1&lt;/code&gt;/&lt;code&gt;key2&lt;/code&gt; 和 &lt;code&gt;value2&lt;/code&gt; 直接转成map</em>
<a class="jxr_linenumber" name="L1610" href="#L1610">1610</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.ArrayUtils#toMap(Object[])</em>
<a class="jxr_linenumber" name="L1611" href="#L1611">1611</a> <em class="jxr_javadoccomment">     * @see java.util.Collections#singletonMap(Object, Object)</em>
<a class="jxr_linenumber" name="L1612" href="#L1612">1612</a> <em class="jxr_javadoccomment">     * @see "com.google.common.collect.ImmutableMap#of(K, V)"</em>
<a class="jxr_linenumber" name="L1613" href="#L1613">1613</a> <em class="jxr_javadoccomment">     * @since 1.9.5</em>
<a class="jxr_linenumber" name="L1614" href="#L1614">1614</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1615" href="#L1615">1615</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;K, V&gt; Map&lt;K, V&gt; toMap(K key1,V value1,K key2,V value2){
<a class="jxr_linenumber" name="L1616" href="#L1616">1616</a>         Map&lt;K, V&gt; map = toMap(key1, value1);
<a class="jxr_linenumber" name="L1617" href="#L1617">1617</a>         map.put(key2, value2);
<a class="jxr_linenumber" name="L1618" href="#L1618">1618</a>         <strong class="jxr_keyword">return</strong> map;
<a class="jxr_linenumber" name="L1619" href="#L1619">1619</a>     }
<a class="jxr_linenumber" name="L1620" href="#L1620">1620</a> 
<a class="jxr_linenumber" name="L1621" href="#L1621">1621</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1622" href="#L1622">1622</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;properties&lt;/code&gt; 转换成map.</em>
<a class="jxr_linenumber" name="L1623" href="#L1623">1623</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1624" href="#L1624">1624</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1625" href="#L1625">1625</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1626" href="#L1626">1626</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1627" href="#L1627">1627</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1628" href="#L1628">1628</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1629" href="#L1629">1629</a> <em class="jxr_javadoccomment">     * Properties properties = new Properties();</em>
<a class="jxr_linenumber" name="L1630" href="#L1630">1630</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1631" href="#L1631">1631</a> <em class="jxr_javadoccomment">     * properties.setProperty("name", "feilong");</em>
<a class="jxr_linenumber" name="L1632" href="#L1632">1632</a> <em class="jxr_javadoccomment">     * properties.setProperty("age", "18");</em>
<a class="jxr_linenumber" name="L1633" href="#L1633">1633</a> <em class="jxr_javadoccomment">     * properties.setProperty("country", "china");</em>
<a class="jxr_linenumber" name="L1634" href="#L1634">1634</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1635" href="#L1635">1635</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(toMap(properties)));</em>
<a class="jxr_linenumber" name="L1636" href="#L1636">1636</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1637" href="#L1637">1637</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1638" href="#L1638">1638</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1639" href="#L1639">1639</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1640" href="#L1640">1640</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1641" href="#L1641">1641</a> <em class="jxr_javadoccomment">     * {</em>
<a class="jxr_linenumber" name="L1642" href="#L1642">1642</a> <em class="jxr_javadoccomment">     * "age": "18",</em>
<a class="jxr_linenumber" name="L1643" href="#L1643">1643</a> <em class="jxr_javadoccomment">     * "country": "china",</em>
<a class="jxr_linenumber" name="L1644" href="#L1644">1644</a> <em class="jxr_javadoccomment">     * "name": "feilong"</em>
<a class="jxr_linenumber" name="L1645" href="#L1645">1645</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1646" href="#L1646">1646</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1647" href="#L1647">1647</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1648" href="#L1648">1648</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1649" href="#L1649">1649</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1650" href="#L1650">1650</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1651" href="#L1651">1651</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1652" href="#L1652">1652</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1653" href="#L1653">1653</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回的map 经过了 {@link SortUtil#sortMapByKeyAsc(Map)}排序处理,方便输出日志&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1654" href="#L1654">1654</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1655" href="#L1655">1655</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1656" href="#L1656">1656</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1657" href="#L1657">1657</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;关于 &lt;code&gt;Properties&lt;/code&gt;&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1658" href="#L1658">1658</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1659" href="#L1659">1659</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1660" href="#L1660">1660</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1661" href="#L1661">1661</a> <em class="jxr_javadoccomment">     * Properties 是 Map的实现类 ,其 key和value 是String 类型.</em>
<a class="jxr_linenumber" name="L1662" href="#L1662">1662</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1663" href="#L1663">1663</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1664" href="#L1664">1664</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1665" href="#L1665">1665</a> <em class="jxr_javadoccomment">     * 因此Properties 可以强制转换成map</em>
<a class="jxr_linenumber" name="L1666" href="#L1666">1666</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1667" href="#L1667">1667</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1668" href="#L1668">1668</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1669" href="#L1669">1669</a> <em class="jxr_javadoccomment">     * @param properties</em>
<a class="jxr_linenumber" name="L1670" href="#L1670">1670</a> <em class="jxr_javadoccomment">     *            the properties</em>
<a class="jxr_linenumber" name="L1671" href="#L1671">1671</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;properties&lt;/code&gt; 是null或者empty,返回 {@link Collections#emptyMap()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1672" href="#L1672">1672</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.MapUtils#toProperties(Map)</em>
<a class="jxr_linenumber" name="L1673" href="#L1673">1673</a> <em class="jxr_javadoccomment">     * @since 1.7.1</em>
<a class="jxr_linenumber" name="L1674" href="#L1674">1674</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1675" href="#L1675">1675</a>     @SuppressWarnings({ <span class="jxr_string">"unchecked"</span>, <span class="jxr_string">"rawtypes"</span> })
<a class="jxr_linenumber" name="L1676" href="#L1676">1676</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Map&lt;String, String&gt; toMap(Properties properties){
<a class="jxr_linenumber" name="L1677" href="#L1677">1677</a>         <strong class="jxr_keyword">if</strong> (isNullOrEmpty(properties)){
<a class="jxr_linenumber" name="L1678" href="#L1678">1678</a>             <strong class="jxr_keyword">return</strong> emptyMap();
<a class="jxr_linenumber" name="L1679" href="#L1679">1679</a>         }
<a class="jxr_linenumber" name="L1680" href="#L1680">1680</a>         <strong class="jxr_keyword">return</strong> sortMapByKeyAsc((Map) properties);<em class="jxr_comment">//为了log方便,使用 treeMap</em>
<a class="jxr_linenumber" name="L1681" href="#L1681">1681</a>     }
<a class="jxr_linenumber" name="L1682" href="#L1682">1682</a> 
<a class="jxr_linenumber" name="L1683" href="#L1683">1683</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1684" href="#L1684">1684</a> <em class="jxr_javadoccomment">     * 将诸如 Map{@code &lt;String, String&gt;} 类型转成 Map{@code &lt;Integer, Integer&gt;} 类型.</em>
<a class="jxr_linenumber" name="L1685" href="#L1685">1685</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1686" href="#L1686">1686</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1687" href="#L1687">1687</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1688" href="#L1688">1688</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1689" href="#L1689">1689</a> <em class="jxr_javadoccomment">     * &lt;li&gt;适合复杂的类型转换场景,如果只是简单的类型转换,你可以直接调用 {@link #toMap(Map, Class, Class)}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1690" href="#L1690">1690</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回的是 {@link LinkedHashMap},顺序依照入参 inputMap&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1691" href="#L1691">1691</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回的是新的map,原来的&lt;code&gt;toMap&lt;/code&gt;参数不受影响&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1692" href="#L1692">1692</a> <em class="jxr_javadoccomment">     * &lt;li&gt;也支持诸如 Map{@code &lt;String, Integer&gt;} 转 Map{@code &lt;Integer, String&gt;} (key和value 使用不同的转换器)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1693" href="#L1693">1693</a> <em class="jxr_javadoccomment">     * &lt;li&gt;也支持诸如 Map{@code &lt;String, String&gt;} 转 Map{@code &lt;Integer, Integer[]&gt;} (单值转数组)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1694" href="#L1694">1694</a> <em class="jxr_javadoccomment">     * &lt;li&gt;也支持诸如 Map{@code &lt;String[], String[]&gt;} 转 Map{@code &lt;Integer[], Long[]&gt;} (数组转数组)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1695" href="#L1695">1695</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1696" href="#L1696">1696</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1697" href="#L1697">1697</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1698" href="#L1698">1698</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1699" href="#L1699">1699</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1700" href="#L1700">1700</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1701" href="#L1701">1701</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1702" href="#L1702">1702</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1703" href="#L1703">1703</a> <em class="jxr_javadoccomment">     * &lt;b&gt;场景1:&lt;/b&gt; 将Map{@code &lt;String, String&gt;} 转 Map{@code &lt;Integer, Integer&gt;} 类型</em>
<a class="jxr_linenumber" name="L1704" href="#L1704">1704</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1705" href="#L1705">1705</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1706" href="#L1706">1706</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1707" href="#L1707">1707</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1708" href="#L1708">1708</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = toMap("1", "2");</em>
<a class="jxr_linenumber" name="L1709" href="#L1709">1709</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1710" href="#L1710">1710</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//key和value 都转成integer 使用相同的转换器&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1711" href="#L1711">1711</a> <em class="jxr_javadoccomment">     * Transformer{@code &lt;String, Integer&gt;} transformer = new SimpleClassTransformer{@code &lt;&gt;}(Integer.class);</em>
<a class="jxr_linenumber" name="L1712" href="#L1712">1712</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1713" href="#L1713">1713</a> <em class="jxr_javadoccomment">     * Map{@code &lt;Integer, Integer&gt;} returnMap = toMap(map, transformer, transformer);</em>
<a class="jxr_linenumber" name="L1714" href="#L1714">1714</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1715" href="#L1715">1715</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// 输出测试&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1716" href="#L1716">1716</a> <em class="jxr_javadoccomment">     * for (Map.Entry{@code &lt;Integer, Integer&gt;} entry : returnMap.entrySet()){</em>
<a class="jxr_linenumber" name="L1717" href="#L1717">1717</a> <em class="jxr_javadoccomment">     *     Integer key = entry.getKey();</em>
<a class="jxr_linenumber" name="L1718" href="#L1718">1718</a> <em class="jxr_javadoccomment">     *     Integer value = entry.getValue();</em>
<a class="jxr_linenumber" name="L1719" href="#L1719">1719</a> <em class="jxr_javadoccomment">     *     LOGGER.debug("key:[{}],value:[{}]", key, value);</em>
<a class="jxr_linenumber" name="L1720" href="#L1720">1720</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1721" href="#L1721">1721</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1722" href="#L1722">1722</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1723" href="#L1723">1723</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1724" href="#L1724">1724</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1725" href="#L1725">1725</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1726" href="#L1726">1726</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1727" href="#L1727">1727</a> <em class="jxr_javadoccomment">     * key:[1],value:[2]</em>
<a class="jxr_linenumber" name="L1728" href="#L1728">1728</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1729" href="#L1729">1729</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1730" href="#L1730">1730</a> <em class="jxr_javadoccomment">     * &lt;hr&gt;</em>
<a class="jxr_linenumber" name="L1731" href="#L1731">1731</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1732" href="#L1732">1732</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1733" href="#L1733">1733</a> <em class="jxr_javadoccomment">     * &lt;b&gt;场景2:&lt;/b&gt; Map{@code &lt;String, String&gt;} 转 Map{@code &lt;Integer, Integer[]&gt;}</em>
<a class="jxr_linenumber" name="L1734" href="#L1734">1734</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1735" href="#L1735">1735</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1736" href="#L1736">1736</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1737" href="#L1737">1737</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1738" href="#L1738">1738</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = toMap("1", "2,2");</em>
<a class="jxr_linenumber" name="L1739" href="#L1739">1739</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1740" href="#L1740">1740</a> <em class="jxr_javadoccomment">     * Transformer{@code &lt;String, Integer&gt;} keyTransformer = new SimpleClassTransformer{@code &lt;&gt;}(Integer.class);</em>
<a class="jxr_linenumber" name="L1741" href="#L1741">1741</a> <em class="jxr_javadoccomment">     * Transformer{@code &lt;String, Integer[]&gt;} valueTransformer = new SimpleClassTransformer{@code &lt;&gt;}(Integer[].class);</em>
<a class="jxr_linenumber" name="L1742" href="#L1742">1742</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1743" href="#L1743">1743</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//key和value转成不同的类型&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1744" href="#L1744">1744</a> <em class="jxr_javadoccomment">     * Map{@code &lt;Integer, Integer[]&gt;} returnMap = toMap(map, keyTransformer, valueTransformer);</em>
<a class="jxr_linenumber" name="L1745" href="#L1745">1745</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1746" href="#L1746">1746</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// 输出测试&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1747" href="#L1747">1747</a> <em class="jxr_javadoccomment">     * for (Map.Entry{@code &lt;Integer, Integer[]&gt;} entry : returnMap.entrySet()){</em>
<a class="jxr_linenumber" name="L1748" href="#L1748">1748</a> <em class="jxr_javadoccomment">     *     Integer key = entry.getKey();</em>
<a class="jxr_linenumber" name="L1749" href="#L1749">1749</a> <em class="jxr_javadoccomment">     *     Integer[] value = entry.getValue();</em>
<a class="jxr_linenumber" name="L1750" href="#L1750">1750</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1751" href="#L1751">1751</a> <em class="jxr_javadoccomment">     *     LOGGER.debug("key:[{}],value:[{}]", key, value);</em>
<a class="jxr_linenumber" name="L1752" href="#L1752">1752</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1753" href="#L1753">1753</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1754" href="#L1754">1754</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1755" href="#L1755">1755</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1756" href="#L1756">1756</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1757" href="#L1757">1757</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1758" href="#L1758">1758</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1759" href="#L1759">1759</a> <em class="jxr_javadoccomment">     * key:[1],value:[[2, 2]]</em>
<a class="jxr_linenumber" name="L1760" href="#L1760">1760</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1761" href="#L1761">1761</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1762" href="#L1762">1762</a> <em class="jxr_javadoccomment">     * &lt;hr&gt;</em>
<a class="jxr_linenumber" name="L1763" href="#L1763">1763</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1764" href="#L1764">1764</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1765" href="#L1765">1765</a> <em class="jxr_javadoccomment">     * &lt;b&gt;场景3:&lt;/b&gt; Map{@code &lt;String[], String[]&gt;} 转 Map{@code &lt;Integer[], Long[]&gt;}</em>
<a class="jxr_linenumber" name="L1766" href="#L1766">1766</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1767" href="#L1767">1767</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1768" href="#L1768">1768</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1769" href="#L1769">1769</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1770" href="#L1770">1770</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String[], String[]&gt;} map = toMap(toArray("1"), toArray("2", "8"));</em>
<a class="jxr_linenumber" name="L1771" href="#L1771">1771</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1772" href="#L1772">1772</a> <em class="jxr_javadoccomment">     * Transformer{@code &lt;String[], Integer[]&gt;} keyTransformer = new SimpleClassTransformer{@code &lt;&gt;}(Integer[].class);</em>
<a class="jxr_linenumber" name="L1773" href="#L1773">1773</a> <em class="jxr_javadoccomment">     * Transformer{@code &lt;String[], Long[]&gt;} valueTransformer = new SimpleClassTransformer{@code &lt;&gt;}(Long[].class);</em>
<a class="jxr_linenumber" name="L1774" href="#L1774">1774</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1775" href="#L1775">1775</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//key和value转成不同的类型&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1776" href="#L1776">1776</a> <em class="jxr_javadoccomment">     * Map{@code &lt;Integer[], Long[]&gt;} returnMap = toMap(map, keyTransformer, valueTransformer);</em>
<a class="jxr_linenumber" name="L1777" href="#L1777">1777</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1778" href="#L1778">1778</a> <em class="jxr_javadoccomment">     * assertThat(returnMap, allOf(hasEntry(toArray(1), toArray(2L, 8L))));</em>
<a class="jxr_linenumber" name="L1779" href="#L1779">1779</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1780" href="#L1780">1780</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1781" href="#L1781">1781</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1782" href="#L1782">1782</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L1783" href="#L1783">1783</a> <em class="jxr_javadoccomment">     * @param &lt;K&gt;</em>
<a class="jxr_linenumber" name="L1784" href="#L1784">1784</a> <em class="jxr_javadoccomment">     *            the key type</em>
<a class="jxr_linenumber" name="L1785" href="#L1785">1785</a> <em class="jxr_javadoccomment">     * @param &lt;V&gt;</em>
<a class="jxr_linenumber" name="L1786" href="#L1786">1786</a> <em class="jxr_javadoccomment">     *            the value type</em>
<a class="jxr_linenumber" name="L1787" href="#L1787">1787</a> <em class="jxr_javadoccomment">     * @param &lt;I&gt;</em>
<a class="jxr_linenumber" name="L1788" href="#L1788">1788</a> <em class="jxr_javadoccomment">     *            返回的map ,key的类型</em>
<a class="jxr_linenumber" name="L1789" href="#L1789">1789</a> <em class="jxr_javadoccomment">     * @param &lt;J&gt;</em>
<a class="jxr_linenumber" name="L1790" href="#L1790">1790</a> <em class="jxr_javadoccomment">     *            返回的map ,value的类型</em>
<a class="jxr_linenumber" name="L1791" href="#L1791">1791</a> <em class="jxr_javadoccomment">     * @param inputMap</em>
<a class="jxr_linenumber" name="L1792" href="#L1792">1792</a> <em class="jxr_javadoccomment">     *            the input map</em>
<a class="jxr_linenumber" name="L1793" href="#L1793">1793</a> <em class="jxr_javadoccomment">     * @param keyTransformer</em>
<a class="jxr_linenumber" name="L1794" href="#L1794">1794</a> <em class="jxr_javadoccomment">     *            key 转换器,如果是null,那么key直接使用&lt;code&gt;inputMap&lt;/code&gt;的key&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1795" href="#L1795">1795</a> <em class="jxr_javadoccomment">     * @param valueTransformer</em>
<a class="jxr_linenumber" name="L1796" href="#L1796">1796</a> <em class="jxr_javadoccomment">     *            value 转换器,如果是null,那么value直接使用&lt;code&gt;inputMap&lt;/code&gt;的value&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1797" href="#L1797">1797</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;inputMap&lt;/code&gt; 是null或者empty,返回 {@link Collections#emptyMap()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1798" href="#L1798">1798</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;keyTransformer&lt;/code&gt; 是null,那么key直接使用&lt;code&gt;inputMap&lt;/code&gt;的key&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1799" href="#L1799">1799</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;valueTransformer&lt;/code&gt; 是null,那么value 直接使用&lt;code&gt;inputMap&lt;/code&gt;的 value&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1800" href="#L1800">1800</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.MapUtils#transformedMap(Map, Transformer, Transformer)</em>
<a class="jxr_linenumber" name="L1801" href="#L1801">1801</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.map.TransformedMap#transformedMap(Map, Transformer, Transformer)</em>
<a class="jxr_linenumber" name="L1802" href="#L1802">1802</a> <em class="jxr_javadoccomment">     * @see &lt;a href="https://github.com/venusdrogon/feilong-core/issues/497"&gt;issues497&lt;/a&gt;</em>
<a class="jxr_linenumber" name="L1803" href="#L1803">1803</a> <em class="jxr_javadoccomment">     * @since 1.9.2</em>
<a class="jxr_linenumber" name="L1804" href="#L1804">1804</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1805" href="#L1805">1805</a>     @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
<a class="jxr_linenumber" name="L1806" href="#L1806">1806</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;K, V, I, J&gt; Map&lt;I, J&gt; toMap(
<a class="jxr_linenumber" name="L1807" href="#L1807">1807</a>                     Map&lt;K, V&gt; inputMap,
<a class="jxr_linenumber" name="L1808" href="#L1808">1808</a>                     <strong class="jxr_keyword">final</strong> Transformer&lt;K, I&gt; keyTransformer,
<a class="jxr_linenumber" name="L1809" href="#L1809">1809</a>                     <strong class="jxr_keyword">final</strong> Transformer&lt;V, J&gt; valueTransformer){
<a class="jxr_linenumber" name="L1810" href="#L1810">1810</a>         <strong class="jxr_keyword">if</strong> (isNullOrEmpty(inputMap)){
<a class="jxr_linenumber" name="L1811" href="#L1811">1811</a>             <strong class="jxr_keyword">return</strong> emptyMap();
<a class="jxr_linenumber" name="L1812" href="#L1812">1812</a>         }
<a class="jxr_linenumber" name="L1813" href="#L1813">1813</a> 
<a class="jxr_linenumber" name="L1814" href="#L1814">1814</a>         Map&lt;I, J&gt; returnMap = <strong class="jxr_keyword">new</strong> LinkedHashMap&lt;&gt;(inputMap.size());
<a class="jxr_linenumber" name="L1815" href="#L1815">1815</a> 
<a class="jxr_linenumber" name="L1816" href="#L1816">1816</a>         <strong class="jxr_keyword">for</strong> (Map.Entry&lt;K, V&gt; entry : inputMap.entrySet()){
<a class="jxr_linenumber" name="L1817" href="#L1817">1817</a>             K key = entry.getKey();
<a class="jxr_linenumber" name="L1818" href="#L1818">1818</a>             V value = entry.getValue();
<a class="jxr_linenumber" name="L1819" href="#L1819">1819</a> 
<a class="jxr_linenumber" name="L1820" href="#L1820">1820</a>             returnMap.put(
<a class="jxr_linenumber" name="L1821" href="#L1821">1821</a>                             <strong class="jxr_keyword">null</strong> == keyTransformer ? (I) key : keyTransformer.transform(key),
<a class="jxr_linenumber" name="L1822" href="#L1822">1822</a>                             <strong class="jxr_keyword">null</strong> == valueTransformer ? (J) value : valueTransformer.transform(value));
<a class="jxr_linenumber" name="L1823" href="#L1823">1823</a>         }
<a class="jxr_linenumber" name="L1824" href="#L1824">1824</a>         <strong class="jxr_keyword">return</strong> returnMap;
<a class="jxr_linenumber" name="L1825" href="#L1825">1825</a>     }
<a class="jxr_linenumber" name="L1826" href="#L1826">1826</a> 
<a class="jxr_linenumber" name="L1827" href="#L1827">1827</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1828" href="#L1828">1828</a> <em class="jxr_javadoccomment">     * 将诸如 Map{@code &lt;String, String&gt;} 类型转成 Map{@code &lt;Integer, Integer&gt;} 类型.</em>
<a class="jxr_linenumber" name="L1829" href="#L1829">1829</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1830" href="#L1830">1830</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1831" href="#L1831">1831</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1832" href="#L1832">1832</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1833" href="#L1833">1833</a> <em class="jxr_javadoccomment">     * &lt;li&gt;适合只是简单的将key value类型转换,而不需要自己再构建Transformer,再去调用 {@link #toMap(Map, Transformer, Transformer)} ,简化操作&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1834" href="#L1834">1834</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回的是 {@link LinkedHashMap},顺序依照入参 inputMap&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1835" href="#L1835">1835</a> <em class="jxr_javadoccomment">     * &lt;li&gt;返回的是新的map,原来的&lt;code&gt;toMap&lt;/code&gt;参数不受影响&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1836" href="#L1836">1836</a> <em class="jxr_javadoccomment">     * &lt;li&gt;也支持诸如 Map{@code &lt;String, Integer&gt;} 转 Map{@code &lt;Integer, String&gt;} (key和value 使用不同的转换器)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1837" href="#L1837">1837</a> <em class="jxr_javadoccomment">     * &lt;li&gt;也支持诸如 Map{@code &lt;String, String&gt;} 转 Map{@code &lt;Integer, Integer[]&gt;} (单值转数组)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1838" href="#L1838">1838</a> <em class="jxr_javadoccomment">     * &lt;li&gt;也支持诸如 Map{@code &lt;String[], String[]&gt;} 转 Map{@code &lt;Integer[], Long[]&gt;} (数组转数组)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1839" href="#L1839">1839</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1840" href="#L1840">1840</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1841" href="#L1841">1841</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1842" href="#L1842">1842</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1843" href="#L1843">1843</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1844" href="#L1844">1844</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1845" href="#L1845">1845</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1846" href="#L1846">1846</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1847" href="#L1847">1847</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1848" href="#L1848">1848</a> <em class="jxr_javadoccomment">     * &lt;b&gt;场景1:&lt;/b&gt; 将Map{@code &lt;String, String&gt;} 转 Map{@code &lt;Integer, Integer&gt;} 类型</em>
<a class="jxr_linenumber" name="L1849" href="#L1849">1849</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1850" href="#L1850">1850</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1851" href="#L1851">1851</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1852" href="#L1852">1852</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1853" href="#L1853">1853</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = toMap("1", "2");</em>
<a class="jxr_linenumber" name="L1854" href="#L1854">1854</a> <em class="jxr_javadoccomment">     * Map{@code &lt;Integer, Integer&gt;} returnMap = toMap(map, Integer.class, Integer.class);</em>
<a class="jxr_linenumber" name="L1855" href="#L1855">1855</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1856" href="#L1856">1856</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// 输出测试&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1857" href="#L1857">1857</a> <em class="jxr_javadoccomment">     * for (Map.Entry{@code &lt;Integer, Integer&gt;} entry : returnMap.entrySet()){</em>
<a class="jxr_linenumber" name="L1858" href="#L1858">1858</a> <em class="jxr_javadoccomment">     *     Integer key = entry.getKey();</em>
<a class="jxr_linenumber" name="L1859" href="#L1859">1859</a> <em class="jxr_javadoccomment">     *     Integer value = entry.getValue();</em>
<a class="jxr_linenumber" name="L1860" href="#L1860">1860</a> <em class="jxr_javadoccomment">     *     LOGGER.debug("key:[{}],value:[{}]", key, value);</em>
<a class="jxr_linenumber" name="L1861" href="#L1861">1861</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1862" href="#L1862">1862</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1863" href="#L1863">1863</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1864" href="#L1864">1864</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1865" href="#L1865">1865</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1866" href="#L1866">1866</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1867" href="#L1867">1867</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1868" href="#L1868">1868</a> <em class="jxr_javadoccomment">     * key:[1],value:[2]</em>
<a class="jxr_linenumber" name="L1869" href="#L1869">1869</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1870" href="#L1870">1870</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1871" href="#L1871">1871</a> <em class="jxr_javadoccomment">     * &lt;hr&gt;</em>
<a class="jxr_linenumber" name="L1872" href="#L1872">1872</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1873" href="#L1873">1873</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1874" href="#L1874">1874</a> <em class="jxr_javadoccomment">     * &lt;b&gt;场景2:&lt;/b&gt; Map{@code &lt;String, String&gt;} 转 Map{@code &lt;Integer, Integer[]&gt;}</em>
<a class="jxr_linenumber" name="L1875" href="#L1875">1875</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1876" href="#L1876">1876</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1877" href="#L1877">1877</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1878" href="#L1878">1878</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1879" href="#L1879">1879</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = toMap("1", "2,2");</em>
<a class="jxr_linenumber" name="L1880" href="#L1880">1880</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1881" href="#L1881">1881</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//key和value转成不同的类型&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1882" href="#L1882">1882</a> <em class="jxr_javadoccomment">     * Map{@code &lt;Integer, Integer[]&gt;} returnMap = toMap(map, Integer.class, Integer[].class);</em>
<a class="jxr_linenumber" name="L1883" href="#L1883">1883</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1884" href="#L1884">1884</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// 输出测试&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1885" href="#L1885">1885</a> <em class="jxr_javadoccomment">     * for (Map.Entry{@code &lt;Integer, Integer[]&gt;} entry : returnMap.entrySet()){</em>
<a class="jxr_linenumber" name="L1886" href="#L1886">1886</a> <em class="jxr_javadoccomment">     *     Integer key = entry.getKey();</em>
<a class="jxr_linenumber" name="L1887" href="#L1887">1887</a> <em class="jxr_javadoccomment">     *     Integer[] value = entry.getValue();</em>
<a class="jxr_linenumber" name="L1888" href="#L1888">1888</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1889" href="#L1889">1889</a> <em class="jxr_javadoccomment">     *     LOGGER.debug("key:[{}],value:[{}]", key, value);</em>
<a class="jxr_linenumber" name="L1890" href="#L1890">1890</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L1891" href="#L1891">1891</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1892" href="#L1892">1892</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1893" href="#L1893">1893</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1894" href="#L1894">1894</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1895" href="#L1895">1895</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1896" href="#L1896">1896</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1897" href="#L1897">1897</a> <em class="jxr_javadoccomment">     * key:[1],value:[[2, 2]]</em>
<a class="jxr_linenumber" name="L1898" href="#L1898">1898</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1899" href="#L1899">1899</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1900" href="#L1900">1900</a> <em class="jxr_javadoccomment">     * &lt;hr&gt;</em>
<a class="jxr_linenumber" name="L1901" href="#L1901">1901</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1902" href="#L1902">1902</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L1903" href="#L1903">1903</a> <em class="jxr_javadoccomment">     * &lt;b&gt;场景3:&lt;/b&gt; Map{@code &lt;String[], String[]&gt;} 转 Map{@code &lt;Integer[], Long[]&gt;}</em>
<a class="jxr_linenumber" name="L1904" href="#L1904">1904</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L1905" href="#L1905">1905</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1906" href="#L1906">1906</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1907" href="#L1907">1907</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1908" href="#L1908">1908</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String[], String[]&gt;} map = toMap(toArray("1"), toArray("2", "8"));</em>
<a class="jxr_linenumber" name="L1909" href="#L1909">1909</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1910" href="#L1910">1910</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//key和value转成不同的类型&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L1911" href="#L1911">1911</a> <em class="jxr_javadoccomment">     * Map{@code &lt;Integer[], Long[]&gt;} returnMap = toMap(map, Integer[].class, Long[].class);</em>
<a class="jxr_linenumber" name="L1912" href="#L1912">1912</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1913" href="#L1913">1913</a> <em class="jxr_javadoccomment">     * assertThat(returnMap, allOf(hasEntry(toArray(1), toArray(2L, 8L))));</em>
<a class="jxr_linenumber" name="L1914" href="#L1914">1914</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1915" href="#L1915">1915</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1916" href="#L1916">1916</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1917" href="#L1917">1917</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1918" href="#L1918">1918</a> <em class="jxr_javadoccomment">     * @param &lt;K&gt;</em>
<a class="jxr_linenumber" name="L1919" href="#L1919">1919</a> <em class="jxr_javadoccomment">     *            the key type</em>
<a class="jxr_linenumber" name="L1920" href="#L1920">1920</a> <em class="jxr_javadoccomment">     * @param &lt;V&gt;</em>
<a class="jxr_linenumber" name="L1921" href="#L1921">1921</a> <em class="jxr_javadoccomment">     *            the value type</em>
<a class="jxr_linenumber" name="L1922" href="#L1922">1922</a> <em class="jxr_javadoccomment">     * @param &lt;I&gt;</em>
<a class="jxr_linenumber" name="L1923" href="#L1923">1923</a> <em class="jxr_javadoccomment">     *            返回的map ,key的类型</em>
<a class="jxr_linenumber" name="L1924" href="#L1924">1924</a> <em class="jxr_javadoccomment">     * @param &lt;J&gt;</em>
<a class="jxr_linenumber" name="L1925" href="#L1925">1925</a> <em class="jxr_javadoccomment">     *            返回的map ,value的类型</em>
<a class="jxr_linenumber" name="L1926" href="#L1926">1926</a> <em class="jxr_javadoccomment">     * @param inputMap</em>
<a class="jxr_linenumber" name="L1927" href="#L1927">1927</a> <em class="jxr_javadoccomment">     *            the input map</em>
<a class="jxr_linenumber" name="L1928" href="#L1928">1928</a> <em class="jxr_javadoccomment">     * @param keyTargetType</em>
<a class="jxr_linenumber" name="L1929" href="#L1929">1929</a> <em class="jxr_javadoccomment">     *            key需要转换成什么类型,类型可以和原map的类型相同或者可以设置为null,均表示返回的map使用&lt;code&gt;inputMap&lt;/code&gt;原样的&lt;code&gt;key&lt;/code&gt;,不会进行类型转换</em>
<a class="jxr_linenumber" name="L1930" href="#L1930">1930</a> <em class="jxr_javadoccomment">     * @param valueTargetType</em>
<a class="jxr_linenumber" name="L1931" href="#L1931">1931</a> <em class="jxr_javadoccomment">     *            value 需要转换成什么类型,类型可以和原map的类型相同或者可以设置为null,均表示返回的map使用&lt;code&gt;inputMap&lt;/code&gt;原样的&lt;code&gt;value&lt;/code&gt;,不会进行类型转换</em>
<a class="jxr_linenumber" name="L1932" href="#L1932">1932</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;inputMap&lt;/code&gt; 是null或者empty,返回 {@link Collections#emptyMap()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1933" href="#L1933">1933</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;keyTargetType&lt;/code&gt; 是null,那么key直接使用&lt;code&gt;inputMap&lt;/code&gt;的key&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1934" href="#L1934">1934</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;valueTargetType&lt;/code&gt; 是null,那么value 直接使用&lt;code&gt;inputMap&lt;/code&gt;的 value&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1935" href="#L1935">1935</a> <em class="jxr_javadoccomment">     * @see #toMap(Map, Transformer, Transformer)</em>
<a class="jxr_linenumber" name="L1936" href="#L1936">1936</a> <em class="jxr_javadoccomment">     * @see &lt;a href="https://github.com/venusdrogon/feilong-core/issues/497"&gt;issues497&lt;/a&gt;</em>
<a class="jxr_linenumber" name="L1937" href="#L1937">1937</a> <em class="jxr_javadoccomment">     * @since 1.9.2</em>
<a class="jxr_linenumber" name="L1938" href="#L1938">1938</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1939" href="#L1939">1939</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;K, V, I, J&gt; Map&lt;I, J&gt; toMap(Map&lt;K, V&gt; inputMap,<strong class="jxr_keyword">final</strong> Class&lt;I&gt; keyTargetType,<strong class="jxr_keyword">final</strong> Class&lt;J&gt; valueTargetType){
<a class="jxr_linenumber" name="L1940" href="#L1940">1940</a>         <strong class="jxr_keyword">if</strong> (isNullOrEmpty(inputMap)){
<a class="jxr_linenumber" name="L1941" href="#L1941">1941</a>             <strong class="jxr_keyword">return</strong> emptyMap();
<a class="jxr_linenumber" name="L1942" href="#L1942">1942</a>         }
<a class="jxr_linenumber" name="L1943" href="#L1943">1943</a> 
<a class="jxr_linenumber" name="L1944" href="#L1944">1944</a>         Transformer&lt;K, I&gt; keyTransformer = <strong class="jxr_keyword">null</strong> == keyTargetType ? <strong class="jxr_keyword">null</strong> : <strong class="jxr_keyword">new</strong> SimpleClassTransformer&lt;K, I&gt;(keyTargetType);
<a class="jxr_linenumber" name="L1945" href="#L1945">1945</a>         Transformer&lt;V, J&gt; valueTransformer = <strong class="jxr_keyword">null</strong> == valueTargetType ? <strong class="jxr_keyword">null</strong> : <strong class="jxr_keyword">new</strong> SimpleClassTransformer&lt;V, J&gt;(valueTargetType);
<a class="jxr_linenumber" name="L1946" href="#L1946">1946</a> 
<a class="jxr_linenumber" name="L1947" href="#L1947">1947</a>         <strong class="jxr_keyword">return</strong> toMap(inputMap, keyTransformer, valueTransformer);
<a class="jxr_linenumber" name="L1948" href="#L1948">1948</a>     }
<a class="jxr_linenumber" name="L1949" href="#L1949">1949</a> 
<a class="jxr_linenumber" name="L1950" href="#L1950">1950</a>     <em class="jxr_comment">//*************************************toProperties*********************************************************</em>
<a class="jxr_linenumber" name="L1951" href="#L1951">1951</a> 
<a class="jxr_linenumber" name="L1952" href="#L1952">1952</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1953" href="#L1953">1953</a> <em class="jxr_javadoccomment">     * 将map转成 {@link Properties}.</em>
<a class="jxr_linenumber" name="L1954" href="#L1954">1954</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1955" href="#L1955">1955</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1956" href="#L1956">1956</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1957" href="#L1957">1957</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L1958" href="#L1958">1958</a> <em class="jxr_javadoccomment">     * &lt;li&gt;由于 Properties 只能保存非空的key和value,因此如果map 有key或者value是null,将会抛出{@link NullPointerException}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L1959" href="#L1959">1959</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L1960" href="#L1960">1960</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1961" href="#L1961">1961</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1962" href="#L1962">1962</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1963" href="#L1963">1963</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1964" href="#L1964">1964</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1965" href="#L1965">1965</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1966" href="#L1966">1966</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1967" href="#L1967">1967</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} map = toMap("name", "feilong");</em>
<a class="jxr_linenumber" name="L1968" href="#L1968">1968</a> <em class="jxr_javadoccomment">     * Properties properties = ConvertUtil.toProperties(map);</em>
<a class="jxr_linenumber" name="L1969" href="#L1969">1969</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1970" href="#L1970">1970</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(properties));</em>
<a class="jxr_linenumber" name="L1971" href="#L1971">1971</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1972" href="#L1972">1972</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1973" href="#L1973">1973</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L1974" href="#L1974">1974</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1975" href="#L1975">1975</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L1976" href="#L1976">1976</a> <em class="jxr_javadoccomment">     * {"name": "feilong"}</em>
<a class="jxr_linenumber" name="L1977" href="#L1977">1977</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L1978" href="#L1978">1978</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1979" href="#L1979">1979</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L1980" href="#L1980">1980</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1981" href="#L1981">1981</a> <em class="jxr_javadoccomment">     * @param map</em>
<a class="jxr_linenumber" name="L1982" href="#L1982">1982</a> <em class="jxr_javadoccomment">     *            the map</em>
<a class="jxr_linenumber" name="L1983" href="#L1983">1983</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;map&lt;/code&gt; 是null,返回 empty Properties&lt;br&gt;</em>
<a class="jxr_linenumber" name="L1984" href="#L1984">1984</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.MapUtils#toProperties(Map)</em>
<a class="jxr_linenumber" name="L1985" href="#L1985">1985</a> <em class="jxr_javadoccomment">     * @since 1.7.3</em>
<a class="jxr_linenumber" name="L1986" href="#L1986">1986</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L1987" href="#L1987">1987</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Properties toProperties(<strong class="jxr_keyword">final</strong> Map&lt;String, String&gt; map){
<a class="jxr_linenumber" name="L1988" href="#L1988">1988</a>         <strong class="jxr_keyword">return</strong> MapUtils.toProperties(map);
<a class="jxr_linenumber" name="L1989" href="#L1989">1989</a>     }
<a class="jxr_linenumber" name="L1990" href="#L1990">1990</a> 
<a class="jxr_linenumber" name="L1991" href="#L1991">1991</a>     <em class="jxr_comment">//*************************************toList*********************************************************</em>
<a class="jxr_linenumber" name="L1992" href="#L1992">1992</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L1993" href="#L1993">1993</a> <em class="jxr_javadoccomment">     * 将枚举 &lt;code&gt;enumeration&lt;/code&gt; 转成 {@link List}.</em>
<a class="jxr_linenumber" name="L1994" href="#L1994">1994</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1995" href="#L1995">1995</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L1996" href="#L1996">1996</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1997" href="#L1997">1997</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L1998" href="#L1998">1998</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L1999" href="#L1999">1999</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2000" href="#L2000">2000</a> <em class="jxr_javadoccomment">     * toList((Enumeration{@code &lt;String&gt;}) null) = emptyList()</em>
<a class="jxr_linenumber" name="L2001" href="#L2001">2001</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2002" href="#L2002">2002</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2003" href="#L2003">2003</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2004" href="#L2004">2004</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2005" href="#L2005">2005</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2006" href="#L2006">2006</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2007" href="#L2007">2007</a> <em class="jxr_javadoccomment">     * @param enumeration</em>
<a class="jxr_linenumber" name="L2008" href="#L2008">2008</a> <em class="jxr_javadoccomment">     *            the enumeration</em>
<a class="jxr_linenumber" name="L2009" href="#L2009">2009</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;enumeration&lt;/code&gt; 是null,返回 {@link Collections#emptyList()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2010" href="#L2010">2010</a> <em class="jxr_javadoccomment">     *         否则返回 {@link Collections#list(Enumeration)}</em>
<a class="jxr_linenumber" name="L2011" href="#L2011">2011</a> <em class="jxr_javadoccomment">     * @see Collections#emptyList()</em>
<a class="jxr_linenumber" name="L2012" href="#L2012">2012</a> <em class="jxr_javadoccomment">     * @see Collections#EMPTY_LIST</em>
<a class="jxr_linenumber" name="L2013" href="#L2013">2013</a> <em class="jxr_javadoccomment">     * @see Collections#list(Enumeration)</em>
<a class="jxr_linenumber" name="L2014" href="#L2014">2014</a> <em class="jxr_javadoccomment">     * @see EnumerationUtils#toList(Enumeration)</em>
<a class="jxr_linenumber" name="L2015" href="#L2015">2015</a> <em class="jxr_javadoccomment">     * @since 1.0.7</em>
<a class="jxr_linenumber" name="L2016" href="#L2016">2016</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2017" href="#L2017">2017</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; List&lt;T&gt; toList(<strong class="jxr_keyword">final</strong> Enumeration&lt;T&gt; enumeration){
<a class="jxr_linenumber" name="L2018" href="#L2018">2018</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong> == enumeration ? Collections.&lt;T&gt; emptyList() : Collections.list(enumeration);
<a class="jxr_linenumber" name="L2019" href="#L2019">2019</a>     }
<a class="jxr_linenumber" name="L2020" href="#L2020">2020</a> 
<a class="jxr_linenumber" name="L2021" href="#L2021">2021</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2022" href="#L2022">2022</a> <em class="jxr_javadoccomment">     * 将 集合 &lt;code&gt;collection&lt;/code&gt; 转成 list.</em>
<a class="jxr_linenumber" name="L2023" href="#L2023">2023</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2024" href="#L2024">2024</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2025" href="#L2025">2025</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2026" href="#L2026">2026</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L2027" href="#L2027">2027</a> <em class="jxr_javadoccomment">     * &lt;li&gt;此方法很适合快速的将set转成list这样的操作&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2028" href="#L2028">2028</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L2029" href="#L2029">2029</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2030" href="#L2030">2030</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2031" href="#L2031">2031</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2032" href="#L2032">2032</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2033" href="#L2033">2033</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2034" href="#L2034">2034</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2035" href="#L2035">2035</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2036" href="#L2036">2036</a> <em class="jxr_javadoccomment">     * Set{@code &lt;String&gt;} set = new LinkedHashSet{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2037" href="#L2037">2037</a> <em class="jxr_javadoccomment">     * Collections.addAll(set, "a", "a", "b", "b");</em>
<a class="jxr_linenumber" name="L2038" href="#L2038">2038</a> <em class="jxr_javadoccomment">     * LOGGER.debug("{}", toList(set));</em>
<a class="jxr_linenumber" name="L2039" href="#L2039">2039</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2040" href="#L2040">2040</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2041" href="#L2041">2041</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L2042" href="#L2042">2042</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2043" href="#L2043">2043</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2044" href="#L2044">2044</a> <em class="jxr_javadoccomment">     * [a,b]</em>
<a class="jxr_linenumber" name="L2045" href="#L2045">2045</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2046" href="#L2046">2046</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2047" href="#L2047">2047</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2048" href="#L2048">2048</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2049" href="#L2049">2049</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2050" href="#L2050">2050</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2051" href="#L2051">2051</a> <em class="jxr_javadoccomment">     * @param collection</em>
<a class="jxr_linenumber" name="L2052" href="#L2052">2052</a> <em class="jxr_javadoccomment">     *            the collection</em>
<a class="jxr_linenumber" name="L2053" href="#L2053">2053</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;collection&lt;/code&gt; 是null,返回 {@link Collections#emptyList()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2054" href="#L2054">2054</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;collection instanceof List&lt;/code&gt;,那么强转成 list返回&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2055" href="#L2055">2055</a> <em class="jxr_javadoccomment">     *         否则返回 &lt;code&gt;new ArrayList(collection)&lt;/code&gt;</em>
<a class="jxr_linenumber" name="L2056" href="#L2056">2056</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.IterableUtils#toList(Iterable)</em>
<a class="jxr_linenumber" name="L2057" href="#L2057">2057</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.IteratorUtils#toList(Iterator)</em>
<a class="jxr_linenumber" name="L2058" href="#L2058">2058</a> <em class="jxr_javadoccomment">     * @since 1.6.1</em>
<a class="jxr_linenumber" name="L2059" href="#L2059">2059</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2060" href="#L2060">2060</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; List&lt;T&gt; toList(<strong class="jxr_keyword">final</strong> Collection&lt;T&gt; collection){
<a class="jxr_linenumber" name="L2061" href="#L2061">2061</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong> == collection ? Collections.&lt;T&gt; emptyList()
<a class="jxr_linenumber" name="L2062" href="#L2062">2062</a>                         : (collection instanceof List ? (List&lt;T&gt;) collection : <strong class="jxr_keyword">new</strong> ArrayList&lt;T&gt;(collection));
<a class="jxr_linenumber" name="L2063" href="#L2063">2063</a>     }
<a class="jxr_linenumber" name="L2064" href="#L2064">2064</a> 
<a class="jxr_linenumber" name="L2065" href="#L2065">2065</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2066" href="#L2066">2066</a> <em class="jxr_javadoccomment">     * 数组转成 ({@link java.util.ArrayList ArrayList}).</em>
<a class="jxr_linenumber" name="L2067" href="#L2067">2067</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2068" href="#L2068">2068</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2069" href="#L2069">2069</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2070" href="#L2070">2070</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L2071" href="#L2071">2071</a> <em class="jxr_javadoccomment">     * &lt;li&gt;此方法返回的list可以进行add等操作&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2072" href="#L2072">2072</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果直接使用{@link java.util.Arrays#asList(Object...) Arrays#asList(Object...)}返回的list没有实现 {@link java.util.Collection#add(Object)</em>
<a class="jxr_linenumber" name="L2073" href="#L2073">2073</a> <em class="jxr_javadoccomment">     * Collection#add(Object)}等方法,执行&lt;code&gt;list.add("c")&lt;/code&gt;;操作的话会导致异常!&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2074" href="#L2074">2074</a> <em class="jxr_javadoccomment">     * &lt;li&gt;而本方法使用 {@link ArrayList#ArrayList(java.util.Collection)} 来进行重新封装返回,可以执行正常的list操作&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2075" href="#L2075">2075</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L2076" href="#L2076">2076</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2077" href="#L2077">2077</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2078" href="#L2078">2078</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2079" href="#L2079">2079</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;特别适合:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2080" href="#L2080">2080</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2081" href="#L2081">2081</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2082" href="#L2082">2082</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2083" href="#L2083">2083</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2084" href="#L2084">2084</a> <em class="jxr_javadoccomment">     * 如果你要通过以下方式来构造list:</em>
<a class="jxr_linenumber" name="L2085" href="#L2085">2085</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2086" href="#L2086">2086</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2087" href="#L2087">2087</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2088" href="#L2088">2088</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2089" href="#L2089">2089</a> <em class="jxr_javadoccomment">     * List{@code &lt;String&gt;} list = new ArrayList{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2090" href="#L2090">2090</a> <em class="jxr_javadoccomment">     * list.add("feilong1");</em>
<a class="jxr_linenumber" name="L2091" href="#L2091">2091</a> <em class="jxr_javadoccomment">     * list.add("feilong2");</em>
<a class="jxr_linenumber" name="L2092" href="#L2092">2092</a> <em class="jxr_javadoccomment">     * list.add("feilong2");</em>
<a class="jxr_linenumber" name="L2093" href="#L2093">2093</a> <em class="jxr_javadoccomment">     * list.add("feilong3");</em>
<a class="jxr_linenumber" name="L2094" href="#L2094">2094</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2095" href="#L2095">2095</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2096" href="#L2096">2096</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2097" href="#L2097">2097</a> <em class="jxr_javadoccomment">     * 此时你可以使用:</em>
<a class="jxr_linenumber" name="L2098" href="#L2098">2098</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2099" href="#L2099">2099</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2100" href="#L2100">2100</a> <em class="jxr_javadoccomment">     * List{@code &lt;String&gt;} list = toList("feilong1", "feilong2", "feilong2", "feilong3");</em>
<a class="jxr_linenumber" name="L2101" href="#L2101">2101</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2102" href="#L2102">2102</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2103" href="#L2103">2103</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2104" href="#L2104">2104</a> <em class="jxr_javadoccomment">     * 代码会更简洁</em>
<a class="jxr_linenumber" name="L2105" href="#L2105">2105</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2106" href="#L2106">2106</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2107" href="#L2107">2107</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2108" href="#L2108">2108</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;甚至于:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2109" href="#L2109">2109</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2110" href="#L2110">2110</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2111" href="#L2111">2111</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2112" href="#L2112">2112</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2113" href="#L2113">2113</a> <em class="jxr_javadoccomment">     * 有很多时候,参数需要一个对象list,构造的时候,你需要这样</em>
<a class="jxr_linenumber" name="L2114" href="#L2114">2114</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2115" href="#L2115">2115</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2116" href="#L2116">2116</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2117" href="#L2117">2117</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2118" href="#L2118">2118</a> <em class="jxr_javadoccomment">     * List{@code &lt;UserAddress&gt;} userAddresseList = new ArrayList{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2119" href="#L2119">2119</a> <em class="jxr_javadoccomment">     * UserAddress userAddress = new UserAddress();</em>
<a class="jxr_linenumber" name="L2120" href="#L2120">2120</a> <em class="jxr_javadoccomment">     * userAddress.setAddress("上海");</em>
<a class="jxr_linenumber" name="L2121" href="#L2121">2121</a> <em class="jxr_javadoccomment">     * userAddresseList.add(userAddress);</em>
<a class="jxr_linenumber" name="L2122" href="#L2122">2122</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2123" href="#L2123">2123</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2124" href="#L2124">2124</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2125" href="#L2125">2125</a> <em class="jxr_javadoccomment">     * 你可以重构成:</em>
<a class="jxr_linenumber" name="L2126" href="#L2126">2126</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2127" href="#L2127">2127</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2128" href="#L2128">2128</a> <em class="jxr_javadoccomment">     * UserAddress userAddress = new UserAddress();</em>
<a class="jxr_linenumber" name="L2129" href="#L2129">2129</a> <em class="jxr_javadoccomment">     * userAddress.setAddress("上海");</em>
<a class="jxr_linenumber" name="L2130" href="#L2130">2130</a> <em class="jxr_javadoccomment">     * List{@code &lt;UserAddress&gt;} userAddresseList = toList(userAddress);</em>
<a class="jxr_linenumber" name="L2131" href="#L2131">2131</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2132" href="#L2132">2132</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2133" href="#L2133">2133</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2134" href="#L2134">2134</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2135" href="#L2135">2135</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2136" href="#L2136">2136</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2137" href="#L2137">2137</a> <em class="jxr_javadoccomment">     * @param arrays</em>
<a class="jxr_linenumber" name="L2138" href="#L2138">2138</a> <em class="jxr_javadoccomment">     *            T数组</em>
<a class="jxr_linenumber" name="L2139" href="#L2139">2139</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;arrays&lt;/code&gt; 是null或者empty,返回 {@link Collections#emptyList()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2140" href="#L2140">2140</a> <em class="jxr_javadoccomment">     *         否则返回 {@code new ArrayList&lt;T&gt;(Arrays.asList(arrays));}</em>
<a class="jxr_linenumber" name="L2141" href="#L2141">2141</a> <em class="jxr_javadoccomment">     * @see java.util.Arrays#asList(Object...)</em>
<a class="jxr_linenumber" name="L2142" href="#L2142">2142</a> <em class="jxr_javadoccomment">     * @see java.util.Collections#singleton(Object)</em>
<a class="jxr_linenumber" name="L2143" href="#L2143">2143</a> <em class="jxr_javadoccomment">     * @see java.util.Collections#addAll(Collection, Object...)</em>
<a class="jxr_linenumber" name="L2144" href="#L2144">2144</a> <em class="jxr_javadoccomment">     * @see java.util.Collections#singletonList(Object)</em>
<a class="jxr_linenumber" name="L2145" href="#L2145">2145</a> <em class="jxr_javadoccomment">     * @see "org.springframework.util.CollectionUtils#arrayToList(Object)"</em>
<a class="jxr_linenumber" name="L2146" href="#L2146">2146</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2147" href="#L2147">2147</a>     @SafeVarargs
<a class="jxr_linenumber" name="L2148" href="#L2148">2148</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; List&lt;T&gt; toList(T...arrays){
<a class="jxr_linenumber" name="L2149" href="#L2149">2149</a>         <strong class="jxr_keyword">return</strong> isNullOrEmpty(arrays) ? Collections.&lt;T&gt; emptyList() : <strong class="jxr_keyword">new</strong> ArrayList&lt;T&gt;(Arrays.asList(arrays));
<a class="jxr_linenumber" name="L2150" href="#L2150">2150</a>     }
<a class="jxr_linenumber" name="L2151" href="#L2151">2151</a> 
<a class="jxr_linenumber" name="L2152" href="#L2152">2152</a>     <em class="jxr_comment">//*************************************toSet*********************************************************</em>
<a class="jxr_linenumber" name="L2153" href="#L2153">2153</a> 
<a class="jxr_linenumber" name="L2154" href="#L2154">2154</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2155" href="#L2155">2155</a> <em class="jxr_javadoccomment">     * 数组转成 Set ({@link java.util.LinkedHashSet LinkedHashSet}).</em>
<a class="jxr_linenumber" name="L2156" href="#L2156">2156</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2157" href="#L2157">2157</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2158" href="#L2158">2158</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2159" href="#L2159">2159</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L2160" href="#L2160">2160</a> <em class="jxr_javadoccomment">     * &lt;li&gt;此方法返回的是{@link java.util.LinkedHashSet LinkedHashSet}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2161" href="#L2161">2161</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L2162" href="#L2162">2162</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2163" href="#L2163">2163</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2164" href="#L2164">2164</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;特别适合:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2165" href="#L2165">2165</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2166" href="#L2166">2166</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2167" href="#L2167">2167</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2168" href="#L2168">2168</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2169" href="#L2169">2169</a> <em class="jxr_javadoccomment">     * 如果你要通过以下方式来构造Set:</em>
<a class="jxr_linenumber" name="L2170" href="#L2170">2170</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2171" href="#L2171">2171</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2172" href="#L2172">2172</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2173" href="#L2173">2173</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2174" href="#L2174">2174</a> <em class="jxr_javadoccomment">     * Set{@code &lt;String&gt;} set = new LinkedHashSet{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2175" href="#L2175">2175</a> <em class="jxr_javadoccomment">     * set.add("feilong1");</em>
<a class="jxr_linenumber" name="L2176" href="#L2176">2176</a> <em class="jxr_javadoccomment">     * set.add("feilong2");</em>
<a class="jxr_linenumber" name="L2177" href="#L2177">2177</a> <em class="jxr_javadoccomment">     * set.add("feilong2");</em>
<a class="jxr_linenumber" name="L2178" href="#L2178">2178</a> <em class="jxr_javadoccomment">     * set.add("feilong3");</em>
<a class="jxr_linenumber" name="L2179" href="#L2179">2179</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2180" href="#L2180">2180</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2181" href="#L2181">2181</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2182" href="#L2182">2182</a> <em class="jxr_javadoccomment">     * 此时你可以使用:</em>
<a class="jxr_linenumber" name="L2183" href="#L2183">2183</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2184" href="#L2184">2184</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2185" href="#L2185">2185</a> <em class="jxr_javadoccomment">     * Set{@code &lt;String&gt;} set = toSet("feilong1", "feilong2", "feilong2", "feilong3");</em>
<a class="jxr_linenumber" name="L2186" href="#L2186">2186</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2187" href="#L2187">2187</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2188" href="#L2188">2188</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2189" href="#L2189">2189</a> <em class="jxr_javadoccomment">     * 代码会更简洁</em>
<a class="jxr_linenumber" name="L2190" href="#L2190">2190</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2191" href="#L2191">2191</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2192" href="#L2192">2192</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2193" href="#L2193">2193</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;甚至于:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2194" href="#L2194">2194</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2195" href="#L2195">2195</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2196" href="#L2196">2196</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2197" href="#L2197">2197</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2198" href="#L2198">2198</a> <em class="jxr_javadoccomment">     * 有很多时候,参数需要一个对象Set,构造的时候,你需要这样</em>
<a class="jxr_linenumber" name="L2199" href="#L2199">2199</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2200" href="#L2200">2200</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2201" href="#L2201">2201</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2202" href="#L2202">2202</a> <em class="jxr_javadoccomment">     * Set{@code &lt;UserAddress&gt;} userAddresseSet = new LinkedHashSet{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2203" href="#L2203">2203</a> <em class="jxr_javadoccomment">     * UserAddress userAddress = new UserAddress();</em>
<a class="jxr_linenumber" name="L2204" href="#L2204">2204</a> <em class="jxr_javadoccomment">     * userAddress.setAddress("上海");</em>
<a class="jxr_linenumber" name="L2205" href="#L2205">2205</a> <em class="jxr_javadoccomment">     * userAddresseSet.add(userAddress);</em>
<a class="jxr_linenumber" name="L2206" href="#L2206">2206</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2207" href="#L2207">2207</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2208" href="#L2208">2208</a> <em class="jxr_javadoccomment">     * 你可以重构成:</em>
<a class="jxr_linenumber" name="L2209" href="#L2209">2209</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2210" href="#L2210">2210</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2211" href="#L2211">2211</a> <em class="jxr_javadoccomment">     * UserAddress userAddress = new UserAddress();</em>
<a class="jxr_linenumber" name="L2212" href="#L2212">2212</a> <em class="jxr_javadoccomment">     * userAddress.setAddress("上海");</em>
<a class="jxr_linenumber" name="L2213" href="#L2213">2213</a> <em class="jxr_javadoccomment">     * Set{@code &lt;UserAddress&gt;} userAddresseSet = toSet(userAddress);</em>
<a class="jxr_linenumber" name="L2214" href="#L2214">2214</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2215" href="#L2215">2215</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2216" href="#L2216">2216</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2217" href="#L2217">2217</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2218" href="#L2218">2218</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2219" href="#L2219">2219</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2220" href="#L2220">2220</a> <em class="jxr_javadoccomment">     * @param arrays</em>
<a class="jxr_linenumber" name="L2221" href="#L2221">2221</a> <em class="jxr_javadoccomment">     *            the arrays</em>
<a class="jxr_linenumber" name="L2222" href="#L2222">2222</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;arrays&lt;/code&gt; 是null或者empty,返回 {@link Collections#emptySet()}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2223" href="#L2223">2223</a> <em class="jxr_javadoccomment">     *         否则返回 {@code new LinkedHashSet&lt;T&gt;(Arrays.asList(arrays));}</em>
<a class="jxr_linenumber" name="L2224" href="#L2224">2224</a> <em class="jxr_javadoccomment">     * @see "com.google.common.collect.Sets#newHashSet(E...)"</em>
<a class="jxr_linenumber" name="L2225" href="#L2225">2225</a> <em class="jxr_javadoccomment">     * @since 1.9.6</em>
<a class="jxr_linenumber" name="L2226" href="#L2226">2226</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2227" href="#L2227">2227</a>     @SafeVarargs
<a class="jxr_linenumber" name="L2228" href="#L2228">2228</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; Set&lt;T&gt; toSet(T...arrays){
<a class="jxr_linenumber" name="L2229" href="#L2229">2229</a>         <strong class="jxr_keyword">return</strong> isNullOrEmpty(arrays) ? Collections.&lt;T&gt; emptySet() : <strong class="jxr_keyword">new</strong> LinkedHashSet&lt;T&gt;(Arrays.asList(arrays));
<a class="jxr_linenumber" name="L2230" href="#L2230">2230</a>     }
<a class="jxr_linenumber" name="L2231" href="#L2231">2231</a> 
<a class="jxr_linenumber" name="L2232" href="#L2232">2232</a>     <em class="jxr_comment">//*************************************toArray*********************************************************</em>
<a class="jxr_linenumber" name="L2233" href="#L2233">2233</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2234" href="#L2234">2234</a> <em class="jxr_javadoccomment">     * 将动态数组转成数组.</em>
<a class="jxr_linenumber" name="L2235" href="#L2235">2235</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2236" href="#L2236">2236</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2237" href="#L2237">2237</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2238" href="#L2238">2238</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2239" href="#L2239">2239</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2240" href="#L2240">2240</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2241" href="#L2241">2241</a> <em class="jxr_javadoccomment">     * String[] array = ConvertUtil.toArray("1", "2");                  =   ["1", "2"];</em>
<a class="jxr_linenumber" name="L2242" href="#L2242">2242</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2243" href="#L2243">2243</a> <em class="jxr_javadoccomment">     * String[] emptyArray = ConvertUtil.{@code &lt;String&gt;}toArray();     =   [] ; //= new String[] {};</em>
<a class="jxr_linenumber" name="L2244" href="#L2244">2244</a> <em class="jxr_javadoccomment">     * Integer[] emptyArray = ConvertUtil.{@code &lt;Integer&gt;}toArray();   =   [] ; //= new Integer[] {};</em>
<a class="jxr_linenumber" name="L2245" href="#L2245">2245</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2246" href="#L2246">2246</a> <em class="jxr_javadoccomment">     * &lt;span style="color:red"&gt;//注意&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L2247" href="#L2247">2247</a> <em class="jxr_javadoccomment">     * String[] nullArray = ConvertUtil.toArray(null)                   =   null;</em>
<a class="jxr_linenumber" name="L2248" href="#L2248">2248</a> <em class="jxr_javadoccomment">     * ConvertUtil.toArray((String) null)                               =   new String[] { null }</em>
<a class="jxr_linenumber" name="L2249" href="#L2249">2249</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2250" href="#L2250">2250</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2251" href="#L2251">2251</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2252" href="#L2252">2252</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2253" href="#L2253">2253</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;注意:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2254" href="#L2254">2254</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2255" href="#L2255">2255</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2256" href="#L2256">2256</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2257" href="#L2257">2257</a> <em class="jxr_javadoccomment">     * 数组是具体化的(reified),而泛型在运行时是被擦除的(erasure)。&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2258" href="#L2258">2258</a> <em class="jxr_javadoccomment">     * 数组是在运行时才去判断数组元素的类型约束,而泛型正好相反,在运行时,泛型的类型信息是会被擦除的,只有编译的时候才会对类型进行强化。</em>
<a class="jxr_linenumber" name="L2259" href="#L2259">2259</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2260" href="#L2260">2260</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2261" href="#L2261">2261</a> <em class="jxr_javadoccomment">     * &lt;b&gt;泛型擦除的规则:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L2262" href="#L2262">2262</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2263" href="#L2263">2263</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L2264" href="#L2264">2264</a> <em class="jxr_javadoccomment">     * &lt;li&gt;所有参数化容器类都被擦除成非参数化的(raw type); 如 List{@code &lt;E&gt;}、List{@code &lt;List&lt;E&gt;&gt;}都被擦除成 List&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2265" href="#L2265">2265</a> <em class="jxr_javadoccomment">     * &lt;li&gt;所有参数化数组都被擦除成非参数化的数组;如 List{@code &lt;E&gt;}[],被擦除成 List[]&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2266" href="#L2266">2266</a> <em class="jxr_javadoccomment">     * &lt;li&gt;Raw type 的容器类,被擦除成其自身,如 List{@code &lt;E&gt;}被擦 除成 List&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2267" href="#L2267">2267</a> <em class="jxr_javadoccomment">     * &lt;li&gt;原生类型(int,String 还有 wrapper 类)都擦除成他们的自身&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2268" href="#L2268">2268</a> <em class="jxr_javadoccomment">     * &lt;li&gt;参数类型 E,如果没有上限,则被擦除成 Object&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2269" href="#L2269">2269</a> <em class="jxr_javadoccomment">     * &lt;li&gt;所有约束参数如{@code &lt;? Extends E&gt;}、{@code &lt;X extends E&gt;}都被擦 除成 E&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2270" href="#L2270">2270</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果有多个约束,擦除成第一个,如{@code &lt;T extends Object &amp; E&gt;},则擦除成 Object&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2271" href="#L2271">2271</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L2272" href="#L2272">2272</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2273" href="#L2273">2273</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2274" href="#L2274">2274</a> <em class="jxr_javadoccomment">     * 这将会导致下面的代码:</em>
<a class="jxr_linenumber" name="L2275" href="#L2275">2275</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2276" href="#L2276">2276</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2277" href="#L2277">2277</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2278" href="#L2278">2278</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2279" href="#L2279">2279</a> <em class="jxr_javadoccomment">     * public static {@code &lt;K, V&gt;} Map{@code &lt;K, V[]&gt;} toArrayValueMap(Map{@code &lt;K, V&gt;} singleValueMap){</em>
<a class="jxr_linenumber" name="L2280" href="#L2280">2280</a> <em class="jxr_javadoccomment">     *     Map{@code &lt;K, V[]&gt;} arrayValueMap = newLinkedHashMap(singleValueMap.size());//保证顺序和参数singleValueMap顺序相同</em>
<a class="jxr_linenumber" name="L2281" href="#L2281">2281</a> <em class="jxr_javadoccomment">     *     for (Map.Entry{@code &lt;K, V&gt;} entry : singleValueMap.entrySet()){</em>
<a class="jxr_linenumber" name="L2282" href="#L2282">2282</a> <em class="jxr_javadoccomment">     *         arrayValueMap.put(entry.getKey(), toArray(entry.getValue()));//注意此处的Value不要声明成V,否则会变成Object数组</em>
<a class="jxr_linenumber" name="L2283" href="#L2283">2283</a> <em class="jxr_javadoccomment">     *     }</em>
<a class="jxr_linenumber" name="L2284" href="#L2284">2284</a> <em class="jxr_javadoccomment">     *     return arrayValueMap;</em>
<a class="jxr_linenumber" name="L2285" href="#L2285">2285</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L2286" href="#L2286">2286</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2287" href="#L2287">2287</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2288" href="#L2288">2288</a> <em class="jxr_javadoccomment">     * 调用的时候,</em>
<a class="jxr_linenumber" name="L2289" href="#L2289">2289</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2290" href="#L2290">2290</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2291" href="#L2291">2291</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String&gt;} singleValueMap = MapUtil.newLinkedHashMap(2);</em>
<a class="jxr_linenumber" name="L2292" href="#L2292">2292</a> <em class="jxr_javadoccomment">     * singleValueMap.put("province", "江苏省");</em>
<a class="jxr_linenumber" name="L2293" href="#L2293">2293</a> <em class="jxr_javadoccomment">     * singleValueMap.put("city", "南通市");</em>
<a class="jxr_linenumber" name="L2294" href="#L2294">2294</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2295" href="#L2295">2295</a> <em class="jxr_javadoccomment">     * Map{@code &lt;String, String[]&gt;} arrayValueMap = MapUtil.toArrayValueMap(singleValueMap);</em>
<a class="jxr_linenumber" name="L2296" href="#L2296">2296</a> <em class="jxr_javadoccomment">     * String[] strings = arrayValueMap.get("province");//此时返回的是 Object[]</em>
<a class="jxr_linenumber" name="L2297" href="#L2297">2297</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2298" href="#L2298">2298</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2299" href="#L2299">2299</a> <em class="jxr_javadoccomment">     * 会出现异常</em>
<a class="jxr_linenumber" name="L2300" href="#L2300">2300</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2301" href="#L2301">2301</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2302" href="#L2302">2302</a> <em class="jxr_javadoccomment">     * java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;</em>
<a class="jxr_linenumber" name="L2303" href="#L2303">2303</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2304" href="#L2304">2304</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2305" href="#L2305">2305</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2306" href="#L2306">2306</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2307" href="#L2307">2307</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2308" href="#L2308">2308</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2309" href="#L2309">2309</a> <em class="jxr_javadoccomment">     * @param arrays</em>
<a class="jxr_linenumber" name="L2310" href="#L2310">2310</a> <em class="jxr_javadoccomment">     *            the arrays</em>
<a class="jxr_linenumber" name="L2311" href="#L2311">2311</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;arrays&lt;/code&gt; 是null,返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2312" href="#L2312">2312</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.ArrayUtils#toArray(Object...)</em>
<a class="jxr_linenumber" name="L2313" href="#L2313">2313</a> <em class="jxr_javadoccomment">     * @since commons-lang 3</em>
<a class="jxr_linenumber" name="L2314" href="#L2314">2314</a> <em class="jxr_javadoccomment">     * @since 1.6.0</em>
<a class="jxr_linenumber" name="L2315" href="#L2315">2315</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2316" href="#L2316">2316</a>     @SafeVarargs
<a class="jxr_linenumber" name="L2317" href="#L2317">2317</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; T[] toArray(T...arrays){
<a class="jxr_linenumber" name="L2318" href="#L2318">2318</a>         <strong class="jxr_keyword">return</strong> ArrayUtils.toArray(arrays);
<a class="jxr_linenumber" name="L2319" href="#L2319">2319</a>     }
<a class="jxr_linenumber" name="L2320" href="#L2320">2320</a> 
<a class="jxr_linenumber" name="L2321" href="#L2321">2321</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2322" href="#L2322">2322</a> <em class="jxr_javadoccomment">     * 将集合 &lt;code&gt;collection&lt;/code&gt; 转成数组.</em>
<a class="jxr_linenumber" name="L2323" href="#L2323">2323</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2324" href="#L2324">2324</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2325" href="#L2325">2325</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2326" href="#L2326">2326</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2327" href="#L2327">2327</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2328" href="#L2328">2328</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2329" href="#L2329">2329</a> <em class="jxr_javadoccomment">     * List{@code &lt;String&gt;} list = new ArrayList{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2330" href="#L2330">2330</a> <em class="jxr_javadoccomment">     * list.add("xinge");</em>
<a class="jxr_linenumber" name="L2331" href="#L2331">2331</a> <em class="jxr_javadoccomment">     * list.add("feilong");</em>
<a class="jxr_linenumber" name="L2332" href="#L2332">2332</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2333" href="#L2333">2333</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2334" href="#L2334">2334</a> <em class="jxr_javadoccomment">     * 以前你需要写成:</em>
<a class="jxr_linenumber" name="L2335" href="#L2335">2335</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2336" href="#L2336">2336</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2337" href="#L2337">2337</a> <em class="jxr_javadoccomment">     * list.toArray(new String[list.size()]);</em>
<a class="jxr_linenumber" name="L2338" href="#L2338">2338</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2339" href="#L2339">2339</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2340" href="#L2340">2340</a> <em class="jxr_javadoccomment">     * 现在你只需要写成:</em>
<a class="jxr_linenumber" name="L2341" href="#L2341">2341</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2342" href="#L2342">2342</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2343" href="#L2343">2343</a> <em class="jxr_javadoccomment">     * String[] array = ConvertUtil.toArray(list, String.class);</em>
<a class="jxr_linenumber" name="L2344" href="#L2344">2344</a> <em class="jxr_javadoccomment">     * LOGGER.info(JsonUtil.format(array));</em>
<a class="jxr_linenumber" name="L2345" href="#L2345">2345</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2346" href="#L2346">2346</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2347" href="#L2347">2347</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L2348" href="#L2348">2348</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2349" href="#L2349">2349</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2350" href="#L2350">2350</a> <em class="jxr_javadoccomment">     * ["xinge","feilong"]</em>
<a class="jxr_linenumber" name="L2351" href="#L2351">2351</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2352" href="#L2352">2352</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2353" href="#L2353">2353</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2354" href="#L2354">2354</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2355" href="#L2355">2355</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2356" href="#L2356">2356</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2357" href="#L2357">2357</a> <em class="jxr_javadoccomment">     * @param collection</em>
<a class="jxr_linenumber" name="L2358" href="#L2358">2358</a> <em class="jxr_javadoccomment">     *            collection</em>
<a class="jxr_linenumber" name="L2359" href="#L2359">2359</a> <em class="jxr_javadoccomment">     * @param arrayComponentType</em>
<a class="jxr_linenumber" name="L2360" href="#L2360">2360</a> <em class="jxr_javadoccomment">     *            数组组件类型的 Class</em>
<a class="jxr_linenumber" name="L2361" href="#L2361">2361</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;collection&lt;/code&gt; 是null,直接返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2362" href="#L2362">2362</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;arrayComponentType&lt;/code&gt; 是null,抛出 {@link NullPointerException}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2363" href="#L2363">2363</a> <em class="jxr_javadoccomment">     * @see java.lang.reflect.Array#newInstance(Class, int)</em>
<a class="jxr_linenumber" name="L2364" href="#L2364">2364</a> <em class="jxr_javadoccomment">     * @see java.lang.reflect.Array#newInstance(Class, int...)</em>
<a class="jxr_linenumber" name="L2365" href="#L2365">2365</a> <em class="jxr_javadoccomment">     * @see java.util.Collection#toArray()</em>
<a class="jxr_linenumber" name="L2366" href="#L2366">2366</a> <em class="jxr_javadoccomment">     * @see java.util.Collection#toArray(Object[])</em>
<a class="jxr_linenumber" name="L2367" href="#L2367">2367</a> <em class="jxr_javadoccomment">     * @see java.util.List#toArray()</em>
<a class="jxr_linenumber" name="L2368" href="#L2368">2368</a> <em class="jxr_javadoccomment">     * @see java.util.List#toArray(Object[])</em>
<a class="jxr_linenumber" name="L2369" href="#L2369">2369</a> <em class="jxr_javadoccomment">     * @see java.util.Vector#toArray()</em>
<a class="jxr_linenumber" name="L2370" href="#L2370">2370</a> <em class="jxr_javadoccomment">     * @see java.util.Vector#toArray(Object[])</em>
<a class="jxr_linenumber" name="L2371" href="#L2371">2371</a> <em class="jxr_javadoccomment">     * @see java.util.LinkedList#toArray()</em>
<a class="jxr_linenumber" name="L2372" href="#L2372">2372</a> <em class="jxr_javadoccomment">     * @see java.util.LinkedList#toArray(Object[])</em>
<a class="jxr_linenumber" name="L2373" href="#L2373">2373</a> <em class="jxr_javadoccomment">     * @see java.util.ArrayList#toArray()</em>
<a class="jxr_linenumber" name="L2374" href="#L2374">2374</a> <em class="jxr_javadoccomment">     * @see java.util.ArrayList#toArray(Object[])</em>
<a class="jxr_linenumber" name="L2375" href="#L2375">2375</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2376" href="#L2376">2376</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.collections4.IteratorUtils#toArray(Iterator,Class)</em>
<a class="jxr_linenumber" name="L2377" href="#L2377">2377</a> <em class="jxr_javadoccomment">     * @see "org.springframework.util.StringUtils#toStringArray(Collection)"</em>
<a class="jxr_linenumber" name="L2378" href="#L2378">2378</a> <em class="jxr_javadoccomment">     * @since 1.2.2</em>
<a class="jxr_linenumber" name="L2379" href="#L2379">2379</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2380" href="#L2380">2380</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; T[] toArray(Collection&lt;T&gt; collection,Class&lt;T&gt; arrayComponentType){
<a class="jxr_linenumber" name="L2381" href="#L2381">2381</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == collection){ <em class="jxr_comment">// since 1.8.6</em>
<a class="jxr_linenumber" name="L2382" href="#L2382">2382</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
<a class="jxr_linenumber" name="L2383" href="#L2383">2383</a>         }
<a class="jxr_linenumber" name="L2384" href="#L2384">2384</a> 
<a class="jxr_linenumber" name="L2385" href="#L2385">2385</a>         Validate.notNull(arrayComponentType, <span class="jxr_string">"arrayComponentType must not be null"</span>);
<a class="jxr_linenumber" name="L2386" href="#L2386">2386</a> 
<a class="jxr_linenumber" name="L2387" href="#L2387">2387</a>         <em class="jxr_comment">// 如果采用大家常用的把a的length设为0,就需要反射API来创建一个大小为size的数组,而这对性能有一定的影响.</em>
<a class="jxr_linenumber" name="L2388" href="#L2388">2388</a>         <em class="jxr_comment">// 所以最好的方式就是直接把a的length设为Collection的size从而避免调用反射API来达到一定的性能优化.</em>
<a class="jxr_linenumber" name="L2389" href="#L2389">2389</a>         T[] array = ArrayUtil.newArray(arrayComponentType, collection.size());
<a class="jxr_linenumber" name="L2390" href="#L2390">2390</a> 
<a class="jxr_linenumber" name="L2391" href="#L2391">2391</a>         <em class="jxr_comment">//注意,toArray(new Object[0]) 和 toArray() 在功能上是相同的. </em>
<a class="jxr_linenumber" name="L2392" href="#L2392">2392</a>         <strong class="jxr_keyword">return</strong> collection.toArray(array);
<a class="jxr_linenumber" name="L2393" href="#L2393">2393</a>     }
<a class="jxr_linenumber" name="L2394" href="#L2394">2394</a> 
<a class="jxr_linenumber" name="L2395" href="#L2395">2395</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2396" href="#L2396">2396</a> <em class="jxr_javadoccomment">     * 将字符串数组 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转成指定类型 &lt;code&gt;targetType&lt;/code&gt; 的数组.</em>
<a class="jxr_linenumber" name="L2397" href="#L2397">2397</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2398" href="#L2398">2398</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2399" href="#L2399">2399</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2400" href="#L2400">2400</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2401" href="#L2401">2401</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2402" href="#L2402">2402</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2403" href="#L2403">2403</a> <em class="jxr_javadoccomment">     * String[] ss = { "2", "1" };</em>
<a class="jxr_linenumber" name="L2404" href="#L2404">2404</a> <em class="jxr_javadoccomment">     * toArray(ss, Long.class);                                     =   new Long[] { 2L, 1L }</em>
<a class="jxr_linenumber" name="L2405" href="#L2405">2405</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2406" href="#L2406">2406</a> <em class="jxr_javadoccomment">     * ConvertUtil.toArray((String[]) null, Serializable.class)     =   null</em>
<a class="jxr_linenumber" name="L2407" href="#L2407">2407</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2408" href="#L2408">2408</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2409" href="#L2409">2409</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2410" href="#L2410">2410</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2411" href="#L2411">2411</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2412" href="#L2412">2412</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2413" href="#L2413">2413</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L2414" href="#L2414">2414</a> <em class="jxr_javadoccomment">     *            the values</em>
<a class="jxr_linenumber" name="L2415" href="#L2415">2415</a> <em class="jxr_javadoccomment">     * @param targetType</em>
<a class="jxr_linenumber" name="L2416" href="#L2416">2416</a> <em class="jxr_javadoccomment">     *            要被转换的目标类型</em>
<a class="jxr_linenumber" name="L2417" href="#L2417">2417</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,那么返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2418" href="#L2418">2418</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;targetType&lt;/code&gt; 是null,抛出 {@link NullPointerException}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2419" href="#L2419">2419</a> <em class="jxr_javadoccomment">     *         否则调用 {@link ConvertUtils#convert(String[], Class)}</em>
<a class="jxr_linenumber" name="L2420" href="#L2420">2420</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.ConvertUtils#convert(String[], Class)</em>
<a class="jxr_linenumber" name="L2421" href="#L2421">2421</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.ConvertUtilsBean#convert(String[], Class)</em>
<a class="jxr_linenumber" name="L2422" href="#L2422">2422</a> <em class="jxr_javadoccomment">     * @since 1.6.0</em>
<a class="jxr_linenumber" name="L2423" href="#L2423">2423</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2424" href="#L2424">2424</a>     @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
<a class="jxr_linenumber" name="L2425" href="#L2425">2425</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; T[] toArray(String[] toBeConvertedValue,Class&lt;T&gt; targetType){
<a class="jxr_linenumber" name="L2426" href="#L2426">2426</a>         <em class="jxr_comment">//如果指定的类型 本身就是数组类型的class,那么返回的类型就是该数组类型,否则将基于指定类型构造数组.</em>
<a class="jxr_linenumber" name="L2427" href="#L2427">2427</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong> == toBeConvertedValue ? <strong class="jxr_keyword">null</strong> : (T[]) ConvertUtils.convert(toBeConvertedValue, targetType);
<a class="jxr_linenumber" name="L2428" href="#L2428">2428</a>     }
<a class="jxr_linenumber" name="L2429" href="#L2429">2429</a>     <em class="jxr_comment">//********************************************************************************</em>
<a class="jxr_linenumber" name="L2430" href="#L2430">2430</a> 
<a class="jxr_linenumber" name="L2431" href="#L2431">2431</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2432" href="#L2432">2432</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转成{@link String}数组.</em>
<a class="jxr_linenumber" name="L2433" href="#L2433">2433</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2434" href="#L2434">2434</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;说明:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2435" href="#L2435">2435</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2436" href="#L2436">2436</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2437" href="#L2437">2437</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2438" href="#L2438">2438</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L2439" href="#L2439">2439</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2440" href="#L2440">2440</a> <em class="jxr_javadoccomment">     * &lt;li&gt;</em>
<a class="jxr_linenumber" name="L2441" href="#L2441">2441</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2442" href="#L2442">2442</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2443" href="#L2443">2443</a> <em class="jxr_javadoccomment">     * 该方法很适合将 &lt;b&gt;非字符串数组的数组&lt;/b&gt; 转换成 &lt;b&gt;字符串数组&lt;/b&gt;,比如</em>
<a class="jxr_linenumber" name="L2444" href="#L2444">2444</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2445" href="#L2445">2445</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2446" href="#L2446">2446</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2447" href="#L2447">2447</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2448" href="#L2448">2448</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2449" href="#L2449">2449</a> <em class="jxr_javadoccomment">     * URL[] urls = {</em>
<a class="jxr_linenumber" name="L2450" href="#L2450">2450</a> <em class="jxr_javadoccomment">     *                URLUtil.newURL("<a href="http://www.exiaoshuo.com/jinyiyexing0/" target="alexandria_uri">http://www.exiaoshuo.com/jinyiyexing0/</a>"),</em>
<a class="jxr_linenumber" name="L2451" href="#L2451">2451</a> <em class="jxr_javadoccomment">     *                URLUtil.newURL("<a href="http://www.exiaoshuo.com/jinyiyexing1/" target="alexandria_uri">http://www.exiaoshuo.com/jinyiyexing1/</a>"),</em>
<a class="jxr_linenumber" name="L2452" href="#L2452">2452</a> <em class="jxr_javadoccomment">     *                URLUtil.newURL("<a href="http://www.exiaoshuo.com/jinyiyexing2/" target="alexandria_uri">http://www.exiaoshuo.com/jinyiyexing2/</a>"),</em>
<a class="jxr_linenumber" name="L2453" href="#L2453">2453</a> <em class="jxr_javadoccomment">     *                null };</em>
<a class="jxr_linenumber" name="L2454" href="#L2454">2454</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2455" href="#L2455">2455</a> <em class="jxr_javadoccomment">     * LOGGER.debug(JsonUtil.format(ConvertUtil.toStrings(urls)));</em>
<a class="jxr_linenumber" name="L2456" href="#L2456">2456</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2457" href="#L2457">2457</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2458" href="#L2458">2458</a> <em class="jxr_javadoccomment">     * &lt;b&gt;返回:&lt;/b&gt;</em>
<a class="jxr_linenumber" name="L2459" href="#L2459">2459</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2460" href="#L2460">2460</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2461" href="#L2461">2461</a> <em class="jxr_javadoccomment">     * [</em>
<a class="jxr_linenumber" name="L2462" href="#L2462">2462</a> <em class="jxr_javadoccomment">     * "<a href="http://www.exiaoshuo.com/jinyiyexing0/" target="alexandria_uri">http://www.exiaoshuo.com/jinyiyexing0/</a>",</em>
<a class="jxr_linenumber" name="L2463" href="#L2463">2463</a> <em class="jxr_javadoccomment">     * "<a href="http://www.exiaoshuo.com/jinyiyexing1/" target="alexandria_uri">http://www.exiaoshuo.com/jinyiyexing1/</a>",</em>
<a class="jxr_linenumber" name="L2464" href="#L2464">2464</a> <em class="jxr_javadoccomment">     * "<a href="http://www.exiaoshuo.com/jinyiyexing2/" target="alexandria_uri">http://www.exiaoshuo.com/jinyiyexing2/</a>",</em>
<a class="jxr_linenumber" name="L2465" href="#L2465">2465</a> <em class="jxr_javadoccomment">     * null</em>
<a class="jxr_linenumber" name="L2466" href="#L2466">2466</a> <em class="jxr_javadoccomment">     * ]</em>
<a class="jxr_linenumber" name="L2467" href="#L2467">2467</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2468" href="#L2468">2468</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2469" href="#L2469">2469</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2470" href="#L2470">2470</a> <em class="jxr_javadoccomment">     * 还有诸如 Integer[] 转成 String[]</em>
<a class="jxr_linenumber" name="L2471" href="#L2471">2471</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2472" href="#L2472">2472</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2473" href="#L2473">2473</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2474" href="#L2474">2474</a> <em class="jxr_javadoccomment">     * ConvertUtil.toStrings(new Integer[] { 1, 2, 5 })     =   [ "1", "2", "5" ]</em>
<a class="jxr_linenumber" name="L2475" href="#L2475">2475</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2476" href="#L2476">2476</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2477" href="#L2477">2477</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2478" href="#L2478">2478</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2479" href="#L2479">2479</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2480" href="#L2480">2480</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2481" href="#L2481">2481</a> <em class="jxr_javadoccomment">     * &lt;li&gt;</em>
<a class="jxr_linenumber" name="L2482" href="#L2482">2482</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2483" href="#L2483">2483</a> <em class="jxr_javadoccomment">     * 也可以将字符串 解析成数组 in the Java language into a &lt;code&gt;List&lt;/code&gt; individual Strings for each element, 根据以下规则:</em>
<a class="jxr_linenumber" name="L2484" href="#L2484">2484</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2485" href="#L2485">2485</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2486" href="#L2486">2486</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;字符串转成数组的规则:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2487" href="#L2487">2487</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2488" href="#L2488">2488</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2489" href="#L2489">2489</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2490" href="#L2490">2490</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2491" href="#L2491">2491</a> <em class="jxr_javadoccomment">     * 参见 {@link org.apache.commons.beanutils.converters.AbstractArrayConverter#parseElements(String) parseElements}</em>
<a class="jxr_linenumber" name="L2492" href="#L2492">2492</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2493" href="#L2493">2493</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2494" href="#L2494">2494</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L2495" href="#L2495">2495</a> <em class="jxr_javadoccomment">     * &lt;li&gt;The string is expected to be a comma-separated list of values.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2496" href="#L2496">2496</a> <em class="jxr_javadoccomment">     * &lt;li&gt;自动去除开头的 &lt;b&gt;'{'&lt;/b&gt; 和 结束的&lt;b&gt;'}'&lt;/b&gt;.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2497" href="#L2497">2497</a> <em class="jxr_javadoccomment">     * &lt;li&gt;每个元素前后的&lt;b&gt;空格将会去除&lt;/b&gt;.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2498" href="#L2498">2498</a> <em class="jxr_javadoccomment">     * &lt;li&gt;Elements in the list may be delimited by single or double quotes.</em>
<a class="jxr_linenumber" name="L2499" href="#L2499">2499</a> <em class="jxr_javadoccomment">     * Within a quoted elements, the normal Java escape sequences are valid.&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2500" href="#L2500">2500</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L2501" href="#L2501">2501</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2502" href="#L2502">2502</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2503" href="#L2503">2503</a> <em class="jxr_javadoccomment">     * 示例:</em>
<a class="jxr_linenumber" name="L2504" href="#L2504">2504</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2505" href="#L2505">2505</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2506" href="#L2506">2506</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2507" href="#L2507">2507</a> <em class="jxr_javadoccomment">     * ConvertUtil.toStrings("{5,4, 8,2;8 9_5@3`a}"); =  ["5","4","8","2","8","9","5","3","a"]</em>
<a class="jxr_linenumber" name="L2508" href="#L2508">2508</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2509" href="#L2509">2509</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2510" href="#L2510">2510</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2511" href="#L2511">2511</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2512" href="#L2512">2512</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2513" href="#L2513">2513</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L2514" href="#L2514">2514</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2515" href="#L2515">2515</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2516" href="#L2516">2516</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2517" href="#L2517">2517</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L2518" href="#L2518">2518</a> <em class="jxr_javadoccomment">     *            the to be converted value</em>
<a class="jxr_linenumber" name="L2519" href="#L2519">2519</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2520" href="#L2520">2520</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.ArrayConverter#convertToType(Class, Object)</em>
<a class="jxr_linenumber" name="L2521" href="#L2521">2521</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.ArrayConverter#parseElements(Class, String)</em>
<a class="jxr_linenumber" name="L2522" href="#L2522">2522</a> <em class="jxr_javadoccomment">     * @see #convert(Object, Class)</em>
<a class="jxr_linenumber" name="L2523" href="#L2523">2523</a> <em class="jxr_javadoccomment">     * @since 1.4.0</em>
<a class="jxr_linenumber" name="L2524" href="#L2524">2524</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2525" href="#L2525">2525</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String[] toStrings(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L2526" href="#L2526">2526</a>         <strong class="jxr_keyword">return</strong> convert(toBeConvertedValue, String[].<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="L2527" href="#L2527">2527</a>     }
<a class="jxr_linenumber" name="L2528" href="#L2528">2528</a> 
<a class="jxr_linenumber" name="L2529" href="#L2529">2529</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2530" href="#L2530">2530</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt;转成{@link Iterator}类型.</em>
<a class="jxr_linenumber" name="L2531" href="#L2531">2531</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2532" href="#L2532">2532</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2533" href="#L2533">2533</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2534" href="#L2534">2534</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2535" href="#L2535">2535</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2536" href="#L2536">2536</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2537" href="#L2537">2537</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;// null&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L2538" href="#L2538">2538</a> <em class="jxr_javadoccomment">     * toIterator(null) = null</em>
<a class="jxr_linenumber" name="L2539" href="#L2539">2539</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2540" href="#L2540">2540</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//PrimitiveArray&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L2541" href="#L2541">2541</a> <em class="jxr_javadoccomment">     * int[] i2 = { 1, 2 };</em>
<a class="jxr_linenumber" name="L2542" href="#L2542">2542</a> <em class="jxr_javadoccomment">     * Iterator{@code &lt;Integer&gt;} iterator = toIterator(i2);</em>
<a class="jxr_linenumber" name="L2543" href="#L2543">2543</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2544" href="#L2544">2544</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//逗号分隔的字符串&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L2545" href="#L2545">2545</a> <em class="jxr_javadoccomment">     * Iterator{@code &lt;String&gt;} iterator = toIterator("1,2");</em>
<a class="jxr_linenumber" name="L2546" href="#L2546">2546</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2547" href="#L2547">2547</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//collection&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L2548" href="#L2548">2548</a> <em class="jxr_javadoccomment">     * List{@code &lt;String&gt;} list = new ArrayList{@code &lt;&gt;}();</em>
<a class="jxr_linenumber" name="L2549" href="#L2549">2549</a> <em class="jxr_javadoccomment">     * list.add("aaaa");</em>
<a class="jxr_linenumber" name="L2550" href="#L2550">2550</a> <em class="jxr_javadoccomment">     * list.add("nnnnn");</em>
<a class="jxr_linenumber" name="L2551" href="#L2551">2551</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2552" href="#L2552">2552</a> <em class="jxr_javadoccomment">     * Iterator{@code &lt;String&gt;} iterator = toIterator(list);</em>
<a class="jxr_linenumber" name="L2553" href="#L2553">2553</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2554" href="#L2554">2554</a> <em class="jxr_javadoccomment">     * &lt;span style="color:green"&gt;//Enumeration&lt;/span&gt;</em>
<a class="jxr_linenumber" name="L2555" href="#L2555">2555</a> <em class="jxr_javadoccomment">     * Enumeration{@code &lt;Object&gt;} enumeration = new StringTokenizer("this is a test");</em>
<a class="jxr_linenumber" name="L2556" href="#L2556">2556</a> <em class="jxr_javadoccomment">     * Iterator{@code &lt;String&gt;} iterator = toIterator(enumeration);</em>
<a class="jxr_linenumber" name="L2557" href="#L2557">2557</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2558" href="#L2558">2558</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2559" href="#L2559">2559</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2560" href="#L2560">2560</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2561" href="#L2561">2561</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2562" href="#L2562">2562</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;支持以下类型:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2563" href="#L2563">2563</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2564" href="#L2564">2564</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2565" href="#L2565">2565</a> <em class="jxr_javadoccomment">     * &lt;ul&gt;</em>
<a class="jxr_linenumber" name="L2566" href="#L2566">2566</a> <em class="jxr_javadoccomment">     * &lt;li&gt;逗号分隔的字符串,先使用{@link ConvertUtil#toStrings(Object)} 转成数组&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2567" href="#L2567">2567</a> <em class="jxr_javadoccomment">     * &lt;li&gt;数组(包括 包装类型数组 以及 原始类型数组)&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2568" href="#L2568">2568</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果是{@link java.util.Map},将 {@link java.util.Map#values()} 转成{@link java.util.Iterator}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2569" href="#L2569">2569</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link java.util.Collection}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2570" href="#L2570">2570</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link java.util.Iterator}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2571" href="#L2571">2571</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link java.util.Enumeration}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2572" href="#L2572">2572</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link java.util.Dictionary}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2573" href="#L2573">2573</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link org.w3c.dom.Node}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2574" href="#L2574">2574</a> <em class="jxr_javadoccomment">     * &lt;li&gt;{@link org.w3c.dom.NodeList}&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2575" href="#L2575">2575</a> <em class="jxr_javadoccomment">     * &lt;/ul&gt;</em>
<a class="jxr_linenumber" name="L2576" href="#L2576">2576</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2577" href="#L2577">2577</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2578" href="#L2578">2578</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2579" href="#L2579">2579</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2580" href="#L2580">2580</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L2581" href="#L2581">2581</a> <em class="jxr_javadoccomment">     *            the to be converted value</em>
<a class="jxr_linenumber" name="L2582" href="#L2582">2582</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2583" href="#L2583">2583</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是字符串,先转成数组,再转成迭代器&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2584" href="#L2584">2584</a> <em class="jxr_javadoccomment">     *         否则转成 {@link IteratorUtils#getIterator(Object)}</em>
<a class="jxr_linenumber" name="L2585" href="#L2585">2585</a> <em class="jxr_javadoccomment">     * @see Collection#iterator()</em>
<a class="jxr_linenumber" name="L2586" href="#L2586">2586</a> <em class="jxr_javadoccomment">     * @see EnumerationIterator#EnumerationIterator(Enumeration)</em>
<a class="jxr_linenumber" name="L2587" href="#L2587">2587</a> <em class="jxr_javadoccomment">     * @see IteratorUtils#asIterator(Enumeration)</em>
<a class="jxr_linenumber" name="L2588" href="#L2588">2588</a> <em class="jxr_javadoccomment">     * @see IteratorUtils#getIterator(Object)</em>
<a class="jxr_linenumber" name="L2589" href="#L2589">2589</a> <em class="jxr_javadoccomment">     * @see "org.apache.taglibs.standard.tag.common.core.ForEachSupport#supportedTypeForEachIterator(Object)"</em>
<a class="jxr_linenumber" name="L2590" href="#L2590">2590</a> <em class="jxr_javadoccomment">     * @since Commons Collections4.0</em>
<a class="jxr_linenumber" name="L2591" href="#L2591">2591</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2592" href="#L2592">2592</a>     @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
<a class="jxr_linenumber" name="L2593" href="#L2593">2593</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; Iterator&lt;T&gt; toIterator(Object toBeConvertedValue){
<a class="jxr_linenumber" name="L2594" href="#L2594">2594</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == toBeConvertedValue){
<a class="jxr_linenumber" name="L2595" href="#L2595">2595</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
<a class="jxr_linenumber" name="L2596" href="#L2596">2596</a>         }
<a class="jxr_linenumber" name="L2597" href="#L2597">2597</a>         <em class="jxr_comment">// 逗号分隔的字符串</em>
<a class="jxr_linenumber" name="L2598" href="#L2598">2598</a>         <strong class="jxr_keyword">if</strong> (toBeConvertedValue instanceof String){
<a class="jxr_linenumber" name="L2599" href="#L2599">2599</a>             <strong class="jxr_keyword">return</strong> toIterator(toStrings(toBeConvertedValue));
<a class="jxr_linenumber" name="L2600" href="#L2600">2600</a>         }
<a class="jxr_linenumber" name="L2601" href="#L2601">2601</a>         <strong class="jxr_keyword">return</strong> (Iterator&lt;T&gt;) IteratorUtils.getIterator(toBeConvertedValue);
<a class="jxr_linenumber" name="L2602" href="#L2602">2602</a>     }
<a class="jxr_linenumber" name="L2603" href="#L2603">2603</a> 
<a class="jxr_linenumber" name="L2604" href="#L2604">2604</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2605" href="#L2605">2605</a> <em class="jxr_javadoccomment">     * 将 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 转成指定 &lt;code&gt;targetType&lt;/code&gt; 类型的对象.</em>
<a class="jxr_linenumber" name="L2606" href="#L2606">2606</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2607" href="#L2607">2607</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2608" href="#L2608">2608</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2609" href="#L2609">2609</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2610" href="#L2610">2610</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2611" href="#L2611">2611</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2612" href="#L2612">2612</a> <em class="jxr_javadoccomment">     * ConvertUtil.convert("1", Integer.class)      =1</em>
<a class="jxr_linenumber" name="L2613" href="#L2613">2613</a> <em class="jxr_javadoccomment">     * ConvertUtil.convert("", Integer.class)       =0</em>
<a class="jxr_linenumber" name="L2614" href="#L2614">2614</a> <em class="jxr_javadoccomment">     * ConvertUtil.convert("1", Long.class)         =1</em>
<a class="jxr_linenumber" name="L2615" href="#L2615">2615</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2616" href="#L2616">2616</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2617" href="#L2617">2617</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2618" href="#L2618">2618</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2619" href="#L2619">2619</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;此外,该方法特别适合数组类型的转换,比如 Type[] 转成 Class []:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2620" href="#L2620">2620</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2621" href="#L2621">2621</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2622" href="#L2622">2622</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2623" href="#L2623">2623</a> <em class="jxr_javadoccomment">     * 原来的写法:</em>
<a class="jxr_linenumber" name="L2624" href="#L2624">2624</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2625" href="#L2625">2625</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2626" href="#L2626">2626</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2627" href="#L2627">2627</a> <em class="jxr_javadoccomment">     * Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();</em>
<a class="jxr_linenumber" name="L2628" href="#L2628">2628</a> <em class="jxr_javadoccomment">     * int length = actualTypeArguments.length;</em>
<a class="jxr_linenumber" name="L2629" href="#L2629">2629</a> <em class="jxr_javadoccomment">     * Class{@code &lt;?&gt;}[] klasses = new Class{@code &lt;?&gt;}[length];</em>
<a class="jxr_linenumber" name="L2630" href="#L2630">2630</a> <em class="jxr_javadoccomment">     * for (int i = 0, j = length; i {@code &lt;} j; ++i){</em>
<a class="jxr_linenumber" name="L2631" href="#L2631">2631</a> <em class="jxr_javadoccomment">     *     klasses[i] = (Class{@code &lt;?&gt;}) actualTypeArguments[i];</em>
<a class="jxr_linenumber" name="L2632" href="#L2632">2632</a> <em class="jxr_javadoccomment">     * }</em>
<a class="jxr_linenumber" name="L2633" href="#L2633">2633</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2634" href="#L2634">2634</a> <em class="jxr_javadoccomment">     * return klasses;</em>
<a class="jxr_linenumber" name="L2635" href="#L2635">2635</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2636" href="#L2636">2636</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2637" href="#L2637">2637</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2638" href="#L2638">2638</a> <em class="jxr_javadoccomment">     * 现在可以重构成:</em>
<a class="jxr_linenumber" name="L2639" href="#L2639">2639</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2640" href="#L2640">2640</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2641" href="#L2641">2641</a> <em class="jxr_javadoccomment">     * Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();</em>
<a class="jxr_linenumber" name="L2642" href="#L2642">2642</a> <em class="jxr_javadoccomment">     * return convert(actualTypeArguments, Class[].class);</em>
<a class="jxr_linenumber" name="L2643" href="#L2643">2643</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2644" href="#L2644">2644</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2645" href="#L2645">2645</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2646" href="#L2646">2646</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2647" href="#L2647">2647</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;注意:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2648" href="#L2648">2648</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2649" href="#L2649">2649</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2650" href="#L2650">2650</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2651" href="#L2651">2651</a> <em class="jxr_javadoccomment">     * &lt;ol&gt;</em>
<a class="jxr_linenumber" name="L2652" href="#L2652">2652</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2653" href="#L2653">2653</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果&lt;code&gt;targetType&lt;/code&gt;的转换器没有注册,&lt;b&gt;那么传入的value原样返回&lt;/b&gt;,&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2654" href="#L2654">2654</a> <em class="jxr_javadoccomment">     * 比如&lt;code&gt;ConvertUtil.convert("zh_CN", Locale.class)&lt;/code&gt; 由于找不到converter,那么返回"zh_CN".</em>
<a class="jxr_linenumber" name="L2655" href="#L2655">2655</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2656" href="#L2656">2656</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2657" href="#L2657">2657</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果转换不了,会使用默认值&lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2658" href="#L2658">2658</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2659" href="#L2659">2659</a> <em class="jxr_javadoccomment">     * &lt;li&gt;如果传的 &lt;code&gt;toBeConvertedValue&lt;/code&gt;是 &lt;code&gt;toBeConvertedValue.getClass().isArray()&lt;/code&gt; 或者 {@link Collection}</em>
<a class="jxr_linenumber" name="L2660" href="#L2660">2660</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2661" href="#L2661">2661</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2662" href="#L2662">2662</a> <em class="jxr_javadoccomment">     * &lt;dl&gt;</em>
<a class="jxr_linenumber" name="L2663" href="#L2663">2663</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;如果 &lt;code&gt;targetType&lt;/code&gt; 不是数组&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L2664" href="#L2664">2664</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;</em>
<a class="jxr_linenumber" name="L2665" href="#L2665">2665</a> <em class="jxr_javadoccomment">     * &lt;p&gt;</em>
<a class="jxr_linenumber" name="L2666" href="#L2666">2666</a> <em class="jxr_javadoccomment">     * 那么&lt;span style="color:red"&gt;会取第一个元素&lt;/span&gt;进行转换,&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2667" href="#L2667">2667</a> <em class="jxr_javadoccomment">     * 参见{@link AbstractConverter#convert(Class, Object)},调用的 {@link AbstractConverter#convertArray(Object)} 方法</em>
<a class="jxr_linenumber" name="L2668" href="#L2668">2668</a> <em class="jxr_javadoccomment">     * &lt;/p&gt;</em>
<a class="jxr_linenumber" name="L2669" href="#L2669">2669</a> <em class="jxr_javadoccomment">     * &lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L2670" href="#L2670">2670</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2671" href="#L2671">2671</a> <em class="jxr_javadoccomment">     * &lt;dt&gt;如果 &lt;code&gt;targetType&lt;/code&gt; 是数组&lt;/dt&gt;</em>
<a class="jxr_linenumber" name="L2672" href="#L2672">2672</a> <em class="jxr_javadoccomment">     * &lt;dd&gt;参见 {@link org.apache.commons.beanutils.converters.ArrayConverter#convertToType(Class, Object) ArrayConverter#convertToType(Class,</em>
<a class="jxr_linenumber" name="L2673" href="#L2673">2673</a> <em class="jxr_javadoccomment">     * Object)} 会基于targetType 构造一个数组对象,大小长度就是 &lt;code&gt;toBeConvertedValue&lt;/code&gt;的大小或者长度, 然后迭代 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 依次进行转换&lt;/dd&gt;</em>
<a class="jxr_linenumber" name="L2674" href="#L2674">2674</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2675" href="#L2675">2675</a> <em class="jxr_javadoccomment">     * &lt;/dl&gt;</em>
<a class="jxr_linenumber" name="L2676" href="#L2676">2676</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2677" href="#L2677">2677</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2678" href="#L2678">2678</a> <em class="jxr_javadoccomment">     * &lt;/li&gt;</em>
<a class="jxr_linenumber" name="L2679" href="#L2679">2679</a> <em class="jxr_javadoccomment">     * &lt;/ol&gt;</em>
<a class="jxr_linenumber" name="L2680" href="#L2680">2680</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2681" href="#L2681">2681</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2682" href="#L2682">2682</a> <em class="jxr_javadoccomment">     * @param &lt;T&gt;</em>
<a class="jxr_linenumber" name="L2683" href="#L2683">2683</a> <em class="jxr_javadoccomment">     *            the generic type</em>
<a class="jxr_linenumber" name="L2684" href="#L2684">2684</a> <em class="jxr_javadoccomment">     * @param toBeConvertedValue</em>
<a class="jxr_linenumber" name="L2685" href="#L2685">2685</a> <em class="jxr_javadoccomment">     *            需要被转换的对象/值</em>
<a class="jxr_linenumber" name="L2686" href="#L2686">2686</a> <em class="jxr_javadoccomment">     * @param targetType</em>
<a class="jxr_linenumber" name="L2687" href="#L2687">2687</a> <em class="jxr_javadoccomment">     *            要转成什么类型</em>
<a class="jxr_linenumber" name="L2688" href="#L2688">2688</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;targetType&lt;/code&gt; 是null,抛出 {@link NullPointerException}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2689" href="#L2689">2689</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;toBeConvertedValue&lt;/code&gt; 是null,那么直接返回null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2690" href="#L2690">2690</a> <em class="jxr_javadoccomment">     *         否则返回 {@link org.apache.commons.beanutils.ConvertUtils#convert(Object, Class)}</em>
<a class="jxr_linenumber" name="L2691" href="#L2691">2691</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.ConvertUtils#convert(Object, Class)</em>
<a class="jxr_linenumber" name="L2692" href="#L2692">2692</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.AbstractConverter#convert(Class, Object)</em>
<a class="jxr_linenumber" name="L2693" href="#L2693">2693</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.beanutils.converters.ArrayConverter#convertToType(Class, Object)</em>
<a class="jxr_linenumber" name="L2694" href="#L2694">2694</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2695" href="#L2695">2695</a>     @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
<a class="jxr_linenumber" name="L2696" href="#L2696">2696</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> &lt;T&gt; T convert(Object toBeConvertedValue,Class&lt;T&gt; targetType){
<a class="jxr_linenumber" name="L2697" href="#L2697">2697</a>         Validate.notNull(targetType, <span class="jxr_string">"targetType can't be null!"</span>);
<a class="jxr_linenumber" name="L2698" href="#L2698">2698</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong> == toBeConvertedValue ? <strong class="jxr_keyword">null</strong> : (T) ConvertUtils.convert(toBeConvertedValue, targetType);
<a class="jxr_linenumber" name="L2699" href="#L2699">2699</a>     }
<a class="jxr_linenumber" name="L2700" href="#L2700">2700</a> 
<a class="jxr_linenumber" name="L2701" href="#L2701">2701</a>     <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L2702" href="#L2702">2702</a> <em class="jxr_javadoccomment">     * 将对象转成 {@link Locale}.</em>
<a class="jxr_linenumber" name="L2703" href="#L2703">2703</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2704" href="#L2704">2704</a> <em class="jxr_javadoccomment">     * &lt;h3&gt;示例:&lt;/h3&gt;</em>
<a class="jxr_linenumber" name="L2705" href="#L2705">2705</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2706" href="#L2706">2706</a> <em class="jxr_javadoccomment">     * &lt;blockquote&gt;</em>
<a class="jxr_linenumber" name="L2707" href="#L2707">2707</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2708" href="#L2708">2708</a> <em class="jxr_javadoccomment">     * &lt;pre class="code"&gt;</em>
<a class="jxr_linenumber" name="L2709" href="#L2709">2709</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLocale(null)       = null</em>
<a class="jxr_linenumber" name="L2710" href="#L2710">2710</a> <em class="jxr_javadoccomment">     * ConvertUtil.toLocale("zh_CN")    = Locale.CHINA</em>
<a class="jxr_linenumber" name="L2711" href="#L2711">2711</a> <em class="jxr_javadoccomment">     * &lt;/pre&gt;</em>
<a class="jxr_linenumber" name="L2712" href="#L2712">2712</a> <em class="jxr_javadoccomment">     * </em>
<a class="jxr_linenumber" name="L2713" href="#L2713">2713</a> <em class="jxr_javadoccomment">     * &lt;/blockquote&gt;</em>
<a class="jxr_linenumber" name="L2714" href="#L2714">2714</a> <em class="jxr_javadoccomment">     *</em>
<a class="jxr_linenumber" name="L2715" href="#L2715">2715</a> <em class="jxr_javadoccomment">     * @param locale</em>
<a class="jxr_linenumber" name="L2716" href="#L2716">2716</a> <em class="jxr_javadoccomment">     *            可以是 &lt;b&gt;null&lt;/b&gt; ,&lt;b&gt;字符串&lt;/b&gt; 或者 直接的 {@link Locale}对象</em>
<a class="jxr_linenumber" name="L2717" href="#L2717">2717</a> <em class="jxr_javadoccomment">     * @return 如果 &lt;code&gt;locale&lt;/code&gt; 是null,返回 null&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2718" href="#L2718">2718</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;locale instanceof &lt;span style="color:green"&gt;Locale&lt;/span&gt;&lt;/code&gt;,返回 &lt;code&gt;(Locale) locale&lt;/code&gt;&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2719" href="#L2719">2719</a> <em class="jxr_javadoccomment">     *         如果 &lt;code&gt;locale instanceof &lt;span style="color:green"&gt;String&lt;/span&gt;&lt;/code&gt;,返回 {@link LocaleUtils#toLocale(String)}&lt;br&gt;</em>
<a class="jxr_linenumber" name="L2720" href="#L2720">2720</a> <em class="jxr_javadoccomment">     *         其他的类型,将抛出 {@link UnsupportedOperationException}</em>
<a class="jxr_linenumber" name="L2721" href="#L2721">2721</a> <em class="jxr_javadoccomment">     * @see org.apache.commons.lang3.LocaleUtils#toLocale(String)</em>
<a class="jxr_linenumber" name="L2722" href="#L2722">2722</a> <em class="jxr_javadoccomment">     * @since 1.7.2</em>
<a class="jxr_linenumber" name="L2723" href="#L2723">2723</a> <em class="jxr_javadoccomment">     */</em>
<a class="jxr_linenumber" name="L2724" href="#L2724">2724</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Locale toLocale(Object locale){
<a class="jxr_linenumber" name="L2725" href="#L2725">2725</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == locale){
<a class="jxr_linenumber" name="L2726" href="#L2726">2726</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
<a class="jxr_linenumber" name="L2727" href="#L2727">2727</a>         }
<a class="jxr_linenumber" name="L2728" href="#L2728">2728</a>         <strong class="jxr_keyword">if</strong> (locale instanceof Locale){
<a class="jxr_linenumber" name="L2729" href="#L2729">2729</a>             <strong class="jxr_keyword">return</strong> (Locale) locale;
<a class="jxr_linenumber" name="L2730" href="#L2730">2730</a>         }
<a class="jxr_linenumber" name="L2731" href="#L2731">2731</a>         <strong class="jxr_keyword">if</strong> (locale instanceof String){
<a class="jxr_linenumber" name="L2732" href="#L2732">2732</a>             <strong class="jxr_keyword">return</strong> LocaleUtils.toLocale((String) locale);
<a class="jxr_linenumber" name="L2733" href="#L2733">2733</a>         }
<a class="jxr_linenumber" name="L2734" href="#L2734">2734</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> UnsupportedOperationException(<span class="jxr_string">"input param [locale] type is:["</span> + locale.getClass().getName() + <span class="jxr_string">"] not support!"</span>);
<a class="jxr_linenumber" name="L2735" href="#L2735">2735</a>     }
<a class="jxr_linenumber" name="L2736" href="#L2736">2736</a> }
</pre>
<hr/>
<div id="footer">Copyright &#169; 2008&#x2013;2017 <a href="http://venusdrogon.github.io/feilong-platform/">feiLong</a>. All rights reserved.</div>
</body>
</html>
